Rebrand from Casera/MyCrib to honeyDue
Total rebrand across KMM project: - Kotlin package: com.example.casera -> com.tt.honeyDue (dirs + declarations) - Gradle: rootProject.name, namespace, applicationId - Android: manifest, strings.xml (all languages), widget resources - iOS: pbxproj bundle IDs, Info.plist, entitlements, xcconfig - iOS directories: Casera/ -> HoneyDue/, CaseraTests/ -> HoneyDueTests/, etc. - Swift source: all class/struct/enum renames - Deep links: casera:// -> honeydue://, .casera -> .honeydue - App icons replaced with honeyDue honeycomb icon - Domains: casera.treytartt.com -> honeyDue.treytartt.com - Bundle IDs: com.tt.casera -> com.tt.honeyDue - Database table names preserved Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
208
composeApp/src/commonMain/kotlin/com/tt/honeyDue/models/User.kt
Normal file
208
composeApp/src/commonMain/kotlin/com/tt/honeyDue/models/User.kt
Normal file
@@ -0,0 +1,208 @@
|
||||
package com.tt.honeyDue.models
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* User model matching Go API UserResponse/CurrentUserResponse
|
||||
*/
|
||||
@Serializable
|
||||
data class User(
|
||||
val id: Int,
|
||||
val username: String,
|
||||
val email: String,
|
||||
@SerialName("first_name") val firstName: String = "",
|
||||
@SerialName("last_name") val lastName: String = "",
|
||||
@SerialName("is_active") val isActive: Boolean = true,
|
||||
@SerialName("date_joined") val dateJoined: String,
|
||||
@SerialName("last_login") val lastLogin: String? = null,
|
||||
// Profile is included in CurrentUserResponse (/auth/me)
|
||||
val profile: UserProfile? = null,
|
||||
// Verified is returned directly in LoginResponse, and also in profile for CurrentUserResponse
|
||||
@SerialName("verified") private val _verified: Boolean = false
|
||||
) {
|
||||
// Computed property for display name
|
||||
val displayName: String
|
||||
get() = when {
|
||||
firstName.isNotBlank() && lastName.isNotBlank() -> "$firstName $lastName"
|
||||
firstName.isNotBlank() -> firstName
|
||||
lastName.isNotBlank() -> lastName
|
||||
else -> username
|
||||
}
|
||||
|
||||
// Check if user is verified - from direct field (login) OR from profile (currentUser)
|
||||
val isVerified: Boolean
|
||||
get() = _verified || (profile?.verified ?: false)
|
||||
|
||||
// Alias for backwards compatibility
|
||||
val verified: Boolean
|
||||
get() = isVerified
|
||||
}
|
||||
|
||||
/**
|
||||
* User profile model matching Go API UserProfileResponse
|
||||
*/
|
||||
@Serializable
|
||||
data class UserProfile(
|
||||
val id: Int,
|
||||
@SerialName("user_id") val userId: Int,
|
||||
val verified: Boolean = false,
|
||||
val bio: String = "",
|
||||
@SerialName("phone_number") val phoneNumber: String = "",
|
||||
@SerialName("date_of_birth") val dateOfBirth: String? = null,
|
||||
@SerialName("profile_picture") val profilePicture: String = ""
|
||||
)
|
||||
|
||||
/**
|
||||
* Register request matching Go API
|
||||
*/
|
||||
@Serializable
|
||||
data class RegisterRequest(
|
||||
val username: String,
|
||||
val email: String,
|
||||
val password: String,
|
||||
@SerialName("first_name") val firstName: String? = null,
|
||||
@SerialName("last_name") val lastName: String? = null
|
||||
)
|
||||
|
||||
/**
|
||||
* Login request matching Go API
|
||||
*/
|
||||
@Serializable
|
||||
data class LoginRequest(
|
||||
val username: String,
|
||||
val password: String
|
||||
)
|
||||
|
||||
/**
|
||||
* Auth response for login - matching Go API LoginResponse
|
||||
*/
|
||||
@Serializable
|
||||
data class AuthResponse(
|
||||
val token: String,
|
||||
val user: User
|
||||
)
|
||||
|
||||
/**
|
||||
* Auth response for registration - matching Go API RegisterResponse
|
||||
*/
|
||||
@Serializable
|
||||
data class RegisterResponse(
|
||||
val token: String,
|
||||
val user: User,
|
||||
val message: String = ""
|
||||
)
|
||||
|
||||
/**
|
||||
* Verify email request
|
||||
*/
|
||||
@Serializable
|
||||
data class VerifyEmailRequest(
|
||||
val code: String
|
||||
)
|
||||
|
||||
/**
|
||||
* Verify email response
|
||||
*/
|
||||
@Serializable
|
||||
data class VerifyEmailResponse(
|
||||
val message: String,
|
||||
val verified: Boolean
|
||||
)
|
||||
|
||||
/**
|
||||
* Update profile request
|
||||
*/
|
||||
@Serializable
|
||||
data class UpdateProfileRequest(
|
||||
@SerialName("first_name") val firstName: String? = null,
|
||||
@SerialName("last_name") val lastName: String? = null,
|
||||
val email: String? = null
|
||||
)
|
||||
|
||||
// Password Reset Models
|
||||
|
||||
@Serializable
|
||||
data class ForgotPasswordRequest(
|
||||
val email: String
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class ForgotPasswordResponse(
|
||||
val message: String
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class VerifyResetCodeRequest(
|
||||
val email: String,
|
||||
val code: String
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class VerifyResetCodeResponse(
|
||||
val message: String,
|
||||
@SerialName("reset_token") val resetToken: String
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class ResetPasswordRequest(
|
||||
@SerialName("reset_token") val resetToken: String,
|
||||
@SerialName("new_password") val newPassword: String
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class ResetPasswordResponse(
|
||||
val message: String
|
||||
)
|
||||
|
||||
/**
|
||||
* Generic message response used by many endpoints
|
||||
*/
|
||||
@Serializable
|
||||
data class MessageResponse(
|
||||
val message: String
|
||||
)
|
||||
|
||||
// Apple Sign In Models
|
||||
|
||||
/**
|
||||
* Apple Sign In request matching Go API
|
||||
*/
|
||||
@Serializable
|
||||
data class AppleSignInRequest(
|
||||
@SerialName("id_token") val idToken: String,
|
||||
@SerialName("user_id") val userId: String,
|
||||
val email: String? = null,
|
||||
@SerialName("first_name") val firstName: String? = null,
|
||||
@SerialName("last_name") val lastName: String? = null
|
||||
)
|
||||
|
||||
/**
|
||||
* Apple Sign In response matching Go API
|
||||
*/
|
||||
@Serializable
|
||||
data class AppleSignInResponse(
|
||||
val token: String,
|
||||
val user: User,
|
||||
@SerialName("is_new_user") val isNewUser: Boolean
|
||||
)
|
||||
|
||||
// Google Sign In Models
|
||||
|
||||
/**
|
||||
* Google Sign In request matching Go API
|
||||
*/
|
||||
@Serializable
|
||||
data class GoogleSignInRequest(
|
||||
@SerialName("id_token") val idToken: String
|
||||
)
|
||||
|
||||
/**
|
||||
* Google Sign In response matching Go API
|
||||
*/
|
||||
@Serializable
|
||||
data class GoogleSignInResponse(
|
||||
val token: String,
|
||||
val user: User,
|
||||
@SerialName("is_new_user") val isNewUser: Boolean
|
||||
)
|
||||
Reference in New Issue
Block a user