Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 약관동의 api 연결 #580

Merged
merged 12 commits into from
Feb 16, 2025
12 changes: 11 additions & 1 deletion app/src/main/java/com/into/websoso/data/mapper/UserMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.into.websoso.data.model.GenrePreferenceEntity
import com.into.websoso.data.model.MyProfileEntity
import com.into.websoso.data.model.NovelPreferenceEntity
import com.into.websoso.data.model.OtherUserProfileEntity
import com.into.websoso.data.model.TermsAgreementEntity
import com.into.websoso.data.model.UserFeedsEntity
import com.into.websoso.data.model.UserFeedsEntity.UserFeedEntity
import com.into.websoso.data.model.UserInfoDetailEntity
Expand All @@ -19,6 +20,7 @@ import com.into.websoso.data.remote.response.GenrePreferenceResponseDto
import com.into.websoso.data.remote.response.MyProfileResponseDto
import com.into.websoso.data.remote.response.NovelPreferenceResponseDto
import com.into.websoso.data.remote.response.OtherUserProfileResponseDto
import com.into.websoso.data.remote.response.TermsAgreementResponseDto
import com.into.websoso.data.remote.response.UserFeedsResponseDto
import com.into.websoso.data.remote.response.UserFeedsResponseDto.UserFeedResponseDto
import com.into.websoso.data.remote.response.UserInfoDetailResponseDto
Expand Down Expand Up @@ -156,4 +158,12 @@ fun UserFeedResponseDto.toData(): UserFeedEntity {
novelRating = this.novelRating,
relevantCategories = this.relevantCategories,
)
}
}

fun TermsAgreementResponseDto.toData(): TermsAgreementEntity {
return TermsAgreementEntity(
serviceAgreed = this.serviceAgreed,
privacyAgreed = this.privacyAgreed,
marketingAgreed = this.marketingAgreed,
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.into.websoso.data.model

data class TermsAgreementEntity(
val serviceAgreed: Boolean,
val privacyAgreed: Boolean,
val marketingAgreed: Boolean,
)
10 changes: 10 additions & 0 deletions app/src/main/java/com/into/websoso/data/remote/api/UserApi.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.into.websoso.data.remote.api

import com.into.websoso.data.remote.request.TermsAgreementRequestDto
import com.into.websoso.data.remote.request.UserInfoRequestDto
import com.into.websoso.data.remote.request.UserProfileEditRequestDto
import com.into.websoso.data.remote.request.UserProfileStatusRequestDto
Expand All @@ -8,6 +9,7 @@ import com.into.websoso.data.remote.response.GenrePreferenceResponseDto
import com.into.websoso.data.remote.response.MyProfileResponseDto
import com.into.websoso.data.remote.response.NovelPreferenceResponseDto
import com.into.websoso.data.remote.response.OtherUserProfileResponseDto
import com.into.websoso.data.remote.response.TermsAgreementResponseDto
import com.into.websoso.data.remote.response.UserFeedsResponseDto
import com.into.websoso.data.remote.response.UserInfoDetailResponseDto
import com.into.websoso.data.remote.response.UserInfoResponseDto
Expand Down Expand Up @@ -106,4 +108,12 @@ interface UserApi {
@Query("lastFeedId") lastFeedId: Long,
@Query("size") size: Int,
): UserFeedsResponseDto

@PATCH("users/terms-settings")
suspend fun patchTermsAgreement(
@Body termsAgreementRequestDto: TermsAgreementRequestDto,
)

@GET("users/terms-settings")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a: 👍

suspend fun getTermsAgreement(): TermsAgreementResponseDto
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.into.websoso.data.remote.request

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class TermsAgreementRequestDto(
@SerialName("serviceAgreed")
val serviceAgreed: Boolean,
@SerialName("privacyAgreed")
val privacyAgreed: Boolean,
@SerialName("marketingAgreed")
val marketingAgreed: Boolean,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.into.websoso.data.remote.response

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class TermsAgreementResponseDto(
@SerialName("serviceAgreed")
val serviceAgreed: Boolean,
@SerialName("privacyAgreed")
val privacyAgreed: Boolean,
@SerialName("marketingAgreed")
val marketingAgreed: Boolean,
)
Loading