Skip to content

Commit

Permalink
#10 [FEAT] RepositoryImpl 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
yihwanggeun committed Dec 6, 2024
1 parent 1b58cf5 commit d40f648
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.sopt.and.core.data.repositoryimpl

import org.sopt.and.core.data.datasource.HobbyDataSource
import org.sopt.and.core.data.service.HobbyService
import org.sopt.and.domain.repository.HobbyRepository

class HobbyRepositoryImpl(private val hobbyDataSource: HobbyDataSource) : HobbyRepository {
override suspend fun getHobby(token: String): Result<String> = runCatching {
val response = hobbyDataSource.getHobby(token)
response.result.hobby
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.sopt.and.core.data.repositoryimpl

import org.sopt.and.core.data.datasource.SignInDataSource
import org.sopt.and.core.data.dto.reqeust.LoginRequest
import org.sopt.and.core.data.service.HobbyService
import org.sopt.and.core.data.service.SignInService
import org.sopt.and.domain.repository.HobbyRepository
import org.sopt.and.domain.repository.SignInRepository

class SignInRepositoryImpl(private val signInDataSource: SignInDataSource) : SignInRepository {
override suspend fun signIn(username: String, password: String): Result<String> = runCatching {
val response = signInDataSource.postSignIn(LoginRequest(username, password))
response.result.token
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.sopt.and.core.data.repositoryimpl

import org.sopt.and.core.data.datasource.SignUpDataSource
import org.sopt.and.core.data.dto.reqeust.CreateUserRequest
import org.sopt.and.core.data.service.HobbyService
import org.sopt.and.core.data.service.SignUpService
import org.sopt.and.domain.repository.HobbyRepository
import org.sopt.and.domain.repository.SignUpRepository

class SignUpRepositoryImpl(private val signUpDataSource: SignUpDataSource) : SignUpRepository {
override suspend fun signUp(username: String, password: String, hobby: String): Result<Unit> = runCatching {
signUpDataSource.postSignUp(CreateUserRequest(username, password, hobby))
}
}

0 comments on commit d40f648

Please sign in to comment.