添加更新数据

This commit is contained in:
2024-07-29 16:50:07 +08:00
parent d23c5f5c7e
commit 53c71973ae
11 changed files with 398 additions and 189 deletions

View File

@@ -1,5 +1,7 @@
package com.aiosman.riderpro.data
import com.aiosman.riderpro.test.TestDatabase
data class AccountProfile(
val id: Int,
val followerCount: Int,
@@ -11,19 +13,16 @@ data class AccountProfile(
)
interface AccountService {
suspend fun getAccountProfile(): AccountProfile
suspend fun getMyAccountProfile(): AccountProfile
suspend fun getAccountProfileById(id: Int): AccountProfile
}
class TestAccountServiceImpl : AccountService {
override suspend fun getAccountProfile(): AccountProfile {
return AccountProfile(
id = 1,
followerCount = 100,
followingCount = 200,
nickName = "Aiosman",
avatar = "https://img.freepik.com/free-photo/white-billboard-template_23-2147726635.jpg?t=st=1722150015~exp=1722153615~hmac=5540620196d7898215d822be26353c87a63d51bbfb2b814e032626e1948a1583&w=740",
bio = "I am a software engineer",
country = "Nigeria"
)
override suspend fun getMyAccountProfile(): AccountProfile {
return TestDatabase.accountData.first { it.id == 0 }
}
override suspend fun getAccountProfileById(id: Int): AccountProfile {
return TestDatabase.accountData.first { it.id == id }
}
}