Skip to content

Commit

Permalink
1) Fixed Dto and Models
Browse files Browse the repository at this point in the history
  • Loading branch information
MajoritySky2496 committed Jun 2, 2024
1 parent 204fb0d commit 8636865
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ data class ProfileAnalyticsDto(

@Serializable
data class UserAnalyticsDto(
@SerialName("income") val incomeDto: List<IncomeDto>,
@SerialName("expense") val expenseDto: List<ExpenseDto>,
@SerialName("wealth_fund") val wealthFundDto: List<WealthFundDto>
@SerialName("income") val incomeDto: List<IncomeDto>?,
@SerialName("expense") val expenseDto: List<ExpenseDto>?,
@SerialName("wealth_fund") val wealthFundDto: List<WealthFundDto>?
)

@Serializable
data class IncomeDto(
val amount: Int,
val amount: Double,
@SerialName("category_id") val categoryId: String,
val date: String,
val id: String,
Expand All @@ -39,7 +39,7 @@ data class IncomeDto(

@Serializable
data class ExpenseDto(
val amount: Int,
val amount: Double,
@SerialName("category_id") val categoryId: String,
val date: String,
val id: String,
Expand All @@ -52,7 +52,7 @@ data class ExpenseDto(

@Serializable
data class WealthFundDto(
val amount: Int,
val amount: Double,
val date: String,
val id: String,
val planned: Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ data class UserInfoMoreDto(
@Serializable
data class AppDto(
@SerialName("category_settings") val categorySettingsDto: CategorySettingsDto,
@SerialName("connected_accounts") val connectedAccountsDto: List<ConnectedAccountDto>
@SerialName("connected_accounts") val connectedAccountsDto: List<ConnectedAccountDto>?
)

@Serializable
Expand All @@ -30,9 +30,9 @@ data class SettingsDto(

@Serializable
data class CategorySettingsDto(
@SerialName("expense_categories") val expenseCategoriesDto: List<ExpenseCategoryDto>,
@SerialName("income_categories") val incomeCategoriesDto: List<IncomeCategoryDto>,
@SerialName("investment_categories") val investmentCategoriesDto: List<InvestmentCategoryDto>
@SerialName("expense_categories") val expenseCategoriesDto: List<ExpenseCategoryDto>?,
@SerialName("income_categories") val incomeCategoriesDto: List<IncomeCategoryDto>?,
@SerialName("investment_category") val investmentCategoriesDto: List<InvestmentCategoryDto>?
)

@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ProfileInfoRepositoryImpl @Inject constructor(
private var userInfoMore:UserInfoMore? = null

private suspend fun getAccessToken(): String {
return credentialsRepository.getCredentials()?.accessToken ?: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkZXZpY2VfaWQiOiJhZWI5NGRkNi0wYTc2LTRjZmUtOWUyMC0xMTI1ODI1N2MzYzAiLCJleHAiOjE3MTcwOTM0NDUsInN1YiI6Ijc2In0.qWawbOvljWwaklSlDsgiNm8dLD_VvwcpYmTp38hIsQ4"
return credentialsRepository.getCredentials()?.accessToken ?: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkZXZpY2VfaWQiOiI2MjFjOTc1OS05ZmY5LTRhNjUtYjI4Mi1hMmEwYmRkYjUxM2IiLCJleHAiOjE3MTczMTA0NjgsInN1YiI6Ijc2In0.enVexw46lCNoIHdu-wkaIbAUjuY4pdd-QszTDCBheGE"
}

override suspend fun getUserInfo(): Resource<UserProfileInfo> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class ProfileAnalyticsDomainMapper @Inject constructor(){
userAnalytics = toUserAnalytics(profileAnalyticsDto.userAnalyticsDto)
)
private fun toUserAnalytics(userAnalyticsDto: UserAnalyticsDto) = UserAnalytics(
income = userAnalyticsDto.incomeDto.map { toIncome(it) },
expense = userAnalyticsDto.expenseDto.map { toExpense(it) },
wealthFund = userAnalyticsDto.wealthFundDto.map { toWealthFund(it) }
income = userAnalyticsDto.incomeDto?.map { toIncome(it) },
expense = userAnalyticsDto.expenseDto?.map { toExpense(it) },
wealthFund = userAnalyticsDto.wealthFundDto?.map { toWealthFund(it) }
)
private fun toIncome(incomeDto: IncomeDto) = Income(
amount = incomeDto.amount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ class UserInfoMoreDomainMapper @Inject constructor() {

private fun toApp(appDto: AppDto) = App(
categorySettings = toCategorySettings(appDto.categorySettingsDto),
connectedAccounts = appDto.connectedAccountsDto.map { toConnectedAccounts(it) }
connectedAccounts = appDto.connectedAccountsDto?.map { toConnectedAccounts(it) }
)

private fun toSettings(settingsDto: SettingsDto) = Settings(
subscriptions = toSubscription(settingsDto.subscriptionsDto)
)
private fun toCategorySettings(categorySettingsDto: CategorySettingsDto) = CategorySettings(
expenseCategories = categorySettingsDto.expenseCategoriesDto.map { toExpenseCategories(it) },
incomeCategories = categorySettingsDto.incomeCategoriesDto.map { toIncomeCategories(it) },
investmentCategories = categorySettingsDto.investmentCategoriesDto.map { toInvestmentCategories(it) }
expenseCategories = categorySettingsDto.expenseCategoriesDto?.map { toExpenseCategories(it) },
incomeCategories = categorySettingsDto.incomeCategoriesDto?.map { toIncomeCategories(it) },
investmentCategories = categorySettingsDto.investmentCategoriesDto?.map { toInvestmentCategories(it) }
)
private fun toConnectedAccounts(connectedAccountDto: ConnectedAccountDto) = ConnectedAccount(
id = connectedAccountDto.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ data class ProfileAnalytics(
)

data class UserAnalytics(
val income: List<Income>,
val expense: List<Expense>,
val wealthFund: List<WealthFund>
val income: List<Income>?,
val expense: List<Expense>?,
val wealthFund: List<WealthFund>?
)

data class Income(
val amount: Int,
val amount: Double,
val categoryId: String,
val date: String,
val id: String,
Expand All @@ -26,7 +26,7 @@ data class Income(
)

data class Expense(
val amount: Int,
val amount: Double,
val categoryId: String,
val date: String,
val id: String,
Expand All @@ -38,7 +38,7 @@ data class Expense(
)

data class WealthFund(
val amount: Int,
val amount: Double,
val date: String,
val id: String,
val planned: Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ data class UserInfoMore(

data class App(
val categorySettings: CategorySettings,
val connectedAccounts: List<ConnectedAccount>
val connectedAccounts: List<ConnectedAccount>?
)

data class Settings(
val subscriptions: Subscriptions
)

data class CategorySettings(
val expenseCategories: List<ExpenseCategory>,
val incomeCategories: List<IncomeCategory>,
val investmentCategories: List<InvestmentCategory>
val expenseCategories: List<ExpenseCategory>?,
val incomeCategories: List<IncomeCategory>?,
val investmentCategories: List<InvestmentCategory>?
)

data class ConnectedAccount(
Expand Down

0 comments on commit 8636865

Please sign in to comment.