Профиль, редактирование без аватара

This commit is contained in:
Халимов Рустам
2026-04-16 15:41:22 +03:00
parent 8409c51842
commit cea3f4d669
45 changed files with 1063 additions and 178 deletions

View File

@@ -6,21 +6,57 @@ interface ContactApi {
@GET("contacts")
suspend fun getContacts(): List<ContactDto>
@POST("contacts/add")
suspend fun addContact(@Body userId: String): ContactDto
@POST("contacts/request")
suspend fun addContact(@Body request: AddContactRequest): Any
@DELETE("contacts/{userId}")
suspend fun removeContact(@Path("userId") userId: String)
@GET("users/search")
suspend fun searchUsers(@Query("query") query: String): List<ContactDto>
@GET("profiles/search")
suspend fun searchUsers(@Query("q") query: String): List<ContactDto>
@GET("contacts/requests")
suspend fun getFriendRequests(): List<FriendRequestDto>
@POST("contacts/{friendshipId}/accept")
suspend fun acceptRequest(@Path("friendshipId") friendshipId: String): Any
@POST("contacts/{friendshipId}/decline")
suspend fun declineRequest(@Path("friendshipId") friendshipId: String): Any
}
data class ContactDto(
data class FriendRequestDto(
val id: String,
val username: String,
val displayName: String?,
val avatarUrl: String?,
val isOnline: Boolean,
val lastSeen: String?
val user: ContactDto,
val createdAt: String,
val isOutgoing: Boolean
)
data class ContactDto(
@com.google.gson.annotations.SerializedName("id")
val id: String,
@com.google.gson.annotations.SerializedName("userName")
val userName: String?,
@com.google.gson.annotations.SerializedName("username")
val username: String?,
@com.google.gson.annotations.SerializedName("displayName")
val displayName: String?,
@com.google.gson.annotations.SerializedName("avatarUrl")
val avatarUrl: String?,
@com.google.gson.annotations.SerializedName("avatar")
val avatar: String?,
@com.google.gson.annotations.SerializedName("isOnline")
val isOnline: Boolean,
@com.google.gson.annotations.SerializedName("lastSeen")
val lastSeen: String?,
@com.google.gson.annotations.SerializedName("friendshipId")
val friendshipId: String? = null
) {
val effectiveUsername: String get() = username ?: userName ?: "unknown"
val effectiveAvatarUrl: String? get() = avatarUrl ?: avatar
}
data class AddContactRequest(
@com.google.gson.annotations.SerializedName("contactId")
val contactId: String
)