Skip to content

Commit

Permalink
[feat/#10] datasource를 구현합니다.
Browse files Browse the repository at this point in the history
  • Loading branch information
SYAAINN committed Dec 2, 2024
1 parent 935d201 commit f48e44e
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.sopt.and.data.remote.datasource

import org.sopt.and.data.remote.model.base.ApiResponse
import org.sopt.and.data.remote.model.request.LoginRequestDto
import org.sopt.and.data.remote.model.request.UserRegistrationRequestDto
import org.sopt.and.data.remote.model.response.LoginResponseDto
import org.sopt.and.data.remote.model.response.UserRegistrationResponseDto

interface AuthRemoteDataSource {
suspend fun registerUser(userRegistrationRequestDto: UserRegistrationRequestDto): ApiResponse<UserRegistrationResponseDto>
suspend fun login(loginRequestDto: LoginRequestDto): ApiResponse<LoginResponseDto>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.sopt.and.data.remote.datasource

import org.sopt.and.data.remote.model.base.ApiResponse
import org.sopt.and.data.remote.model.request.UserInfoUpdateRequestDto
import org.sopt.and.data.remote.model.response.HobbyResponseDto

interface UserRemoteDataSource {
suspend fun getMyHobby(token: String): ApiResponse<HobbyResponseDto>
suspend fun getOthersHobby(token: String, userNo: Int): ApiResponse<HobbyResponseDto>
suspend fun updateUserInfo(token: String, userInfoUpdateRequestDto: UserInfoUpdateRequestDto): ApiResponse<Unit>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.sopt.and.data.remote.datasourceimpl

import org.sopt.and.data.remote.datasource.AuthRemoteDataSource
import org.sopt.and.data.remote.model.base.ApiResponse
import org.sopt.and.data.remote.model.request.LoginRequestDto
import org.sopt.and.data.remote.model.request.UserRegistrationRequestDto
import org.sopt.and.data.remote.model.response.LoginResponseDto
import org.sopt.and.data.remote.model.response.UserRegistrationResponseDto
import org.sopt.and.data.remote.service.AuthService
import javax.inject.Inject

class AuthRemoteDataSourceImpl @Inject constructor(
private val authService: AuthService
) : AuthRemoteDataSource {
override suspend fun registerUser(userRegistrationRequestDto: UserRegistrationRequestDto): ApiResponse<UserRegistrationResponseDto> =
authService.registerUser(userRegistrationRequestDto = userRegistrationRequestDto)

override suspend fun login(loginRequestDto: LoginRequestDto): ApiResponse<LoginResponseDto> =
authService.login(loginRequestDto = loginRequestDto)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.sopt.and.data.remote.datasourceimpl

import org.sopt.and.data.remote.datasource.UserRemoteDataSource
import org.sopt.and.data.remote.model.base.ApiResponse
import org.sopt.and.data.remote.model.request.UserInfoUpdateRequestDto
import org.sopt.and.data.remote.model.response.HobbyResponseDto
import org.sopt.and.data.remote.service.UserService
import javax.inject.Inject

class UserRemoteDataSourceImpl @Inject constructor(
private val userService: UserService
): UserRemoteDataSource {
override suspend fun getMyHobby(token: String): ApiResponse<HobbyResponseDto> =
userService.getMyHobby(token = token)


override suspend fun getOthersHobby(token: String, userNo: Int): ApiResponse<HobbyResponseDto> =
userService.getOthersHobby(token = token, userNo = userNo)

override suspend fun updateUserInfo(
token: String,
userInfoUpdateRequestDto: UserInfoUpdateRequestDto
): ApiResponse<Unit> =
userService.updateUserInfo(token = token, userInfoUpdateRequestDto = userInfoUpdateRequestDto)
}

0 comments on commit f48e44e

Please sign in to comment.