Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/src/main/java/com/hsLink/hslink/data/di/NetworkModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.hsLink.hslink.data.di

import com.hsLink.hslink.BuildConfig
import com.hsLink.hslink.data.remote.AuthInterceptor
import com.hsLink.hslink.data.service.CareerService
import com.hsLink.hslink.data.service.commuunity.CommunityPostService
import com.hsLink.hslink.data.service.home.PostService
import com.hsLink.hslink.data.service.login.AuthService
Expand Down Expand Up @@ -76,4 +77,9 @@ object NetworkModule {
fun provideOnboardingService(retrofit: Retrofit): OnboardingService {
return retrofit.create(OnboardingService::class.java)
}
@Provides
@Singleton
fun provideCareerService(retrofit: Retrofit): CareerService {
return retrofit.create(CareerService::class.java)
}
}
16 changes: 15 additions & 1 deletion app/src/main/java/com/hsLink/hslink/data/di/RepositoryModule.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package com.hsLink.hslink.data.di

import com.hsLink.hslink.data.repositoryimpl.AuthRepositoryImpl
import com.hsLink.hslink.data.repositoryimpl.CareerRepositoryImpl
import com.hsLink.hslink.data.repositoryimpl.CommunityRepositoryImpl
import com.hsLink.hslink.data.repositoryimpl.DummyRepositoryImpl
import com.hsLink.hslink.data.repositoryimpl.home.PostRepositoryImpl
import com.hsLink.hslink.data.repositoryimpl.mypage.MypageRepositoryImpl
import com.hsLink.hslink.data.repositoryimpl.onboarding.OnboardingRepositoryImpl
import com.hsLink.hslink.data.repositoryimpl.search.SearchRepositoryImpl
import com.hsLink.hslink.domain.DummyRepository
import com.hsLink.hslink.domain.repository.AuthRepository
import com.hsLink.hslink.domain.repository.CareerRepository
import com.hsLink.hslink.domain.repository.community.CommunityRepository
import com.hsLink.hslink.domain.repository.home.PostRepository
import com.hsLink.hslink.domain.repository.mypage.MypageRepository
import com.hsLink.hslink.domain.repository.onboarding.OnboardingRepository
import com.hsLink.hslink.domain.repository.search.SearchRepository
import dagger.Binds
Expand Down Expand Up @@ -48,8 +52,18 @@ interface RepositoryModule {
searchRepositoryImpl: SearchRepositoryImpl,
): SearchRepository

@Binds
fun bindMypageRepository(
mypageRepositoryImpl: MypageRepositoryImpl
): MypageRepository

@Binds
fun bindsOnboardingRepository(
onboardingRepositoryImpl: OnboardingRepositoryImpl,
): OnboardingRepository
}

@Binds
fun bindCareerRepository(
careerRepositoryImpl: CareerRepositoryImpl
): CareerRepository
}
6 changes: 6 additions & 0 deletions app/src/main/java/com/hsLink/hslink/data/di/ServiceModule.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.hsLink.hslink.data.di

import com.hsLink.hslink.data.service.DummyService
import com.hsLink.hslink.data.service.mypage.MypageService
import com.hsLink.hslink.data.service.search.SearchService
import dagger.Module
import dagger.Provides
Expand All @@ -23,5 +24,10 @@ object ServiceModule {
fun provideSearchService(retrofit: Retrofit): SearchService {
return retrofit.create(SearchService::class.java)
}
@Provides
@Singleton
fun provideMypageService(retrofit: Retrofit): MypageService {
return retrofit.create(MypageService::class.java)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.hsLink.hslink.data.dto.request.common

import kotlinx.serialization.Serializable

// data/dto/common/JobType.kt
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Incorrect file path in comment.

The comment states data/dto/common/JobType.kt, but the actual package is com.hsLink.hslink.data.dto.request.common (line 1).

Apply this diff:

-// data/dto/common/JobType.kt
+// data/dto/request/common/JobType.kt
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// data/dto/common/JobType.kt
// data/dto/request/common/JobType.kt
🤖 Prompt for AI Agents
In app/src/main/java/com/hsLink/hslink/data/dto/request/common/JobType.kt around
line 5, the top-of-file comment incorrectly shows the path
"data/dto/common/JobType.kt"; update that comment to the correct path matching
the package (com/hsLink/hslink/data/dto/request/common/JobType.kt) or remove the
stale path comment so it no longer misrepresents the file location.

@Serializable
enum class JobType {
PERMANENT, // 정규직
TEMPORARY, // 계약직
INTERN, // 인턴
FREELANCER // 프리랜서
}
Comment on lines +1 to +12
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Consider relocating to common package and consolidating duplicate JobType.

Two concerns:

  1. Package location: This enum is placed in data.dto.request.common, but it's also used in response DTOs (e.g., CareerDto). Consider moving it to data.dto.common for better organization.

  2. Duplicate enum: Based on imports in CareerResponse.kt, there's already a JobType enum in presentation.onboarding.model. Having two separate JobType enums violates DRY and can cause import confusion.

Recommendation:

  • Consolidate to a single JobType enum in data.dto.common (or domain.model.common)
  • Remove the duplicate from presentation.onboarding.model
  • Update all references throughout the codebase to use the canonical version

This will prevent future bugs from mixing the two types and improve maintainability.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// data/dto/request/mypage/UpdateProfileRequestDto.kt
package com.hsLink.hslink.data.dto.request.mypage

import kotlinx.serialization.Serializable

@Serializable
data class UpdateProfileRequestDto(
val studentNumber: String? = null,
val name: String? = null,
val major: String? = null,
val mentor: Boolean? = null,
val jobSeeking: Boolean? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,14 @@ data class LinkRequest(
val type: LinkType,
@SerialName("url")
val url: String
)
)
@Serializable
data class CareerUpdateRequestDto(
val companyName: String,
val position: String,
val jobType: JobType,
val startYm: String,
val endYm: String?,
val employed: Boolean
)

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ data class LinkResponse(
@SerialName("url") val url: String,
)


@Serializable
data class CareerDto(
val id: Long,
val companyName: String,
val position: String,
val jobType: JobType,
val employed: Boolean,
val startYm: String,
val endYm: String?
)
Comment on lines +29 to +38
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

ID type inconsistency and duplicate JobType enum.

Two critical issues:

  1. ID type mismatch: CareerResponse.id is Int (line 12), but CareerDto.id is Long (line 31). Since both represent career entities from the same backend, this inconsistency can cause casting errors or data loss.

  2. Duplicate JobType enum: The file imports JobType from presentation.onboarding.model (line 5) for CareerResponse, while CareerDto appears to use a different JobType from data.dto.request.common. Having two separate enums with the same name violates DRY and can lead to confusion and serialization issues.

Recommendations:

  • Standardize the ID type (use Long consistently for all career IDs)
  • Consolidate to a single JobType enum (preferably in the data layer) and remove the duplicate from presentation.onboarding.model
  • Update all references to use the canonical JobType

Apply this diff to fix the ID type:

 @Serializable
 data class CareerResponse(
-    @SerialName("id") val id: Int,
+    @SerialName("id") val id: Long,
     @SerialName("companyName") val companyName: String,
     @SerialName("position") val position: String,
     @SerialName("jobType") val jobType: JobType,
     @SerialName("employed") val employed: Boolean,
     @SerialName("startYm") val startYm: String,
     @SerialName("endYm") val endYm: String?,
 )

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In app/src/main/java/com/hsLink/hslink/data/dto/response/CareerResponse.kt
around lines 29 to 38, the CareerResponse and CareerDto disagree on id type (Int
vs Long) and two different JobType enums are being used; change
CareerResponse.id to Long to match CareerDto, replace the import of JobType from
presentation.onboarding.model with the canonical JobType from
data.dto.request.common (or the shared data-layer enum), remove the duplicate
presentation-layer enum, and update all usages/imports across the module to
reference the single data-layer JobType so serialization and type-safety are
consistent.



typealias CareerListResponseDto = List<CareerResponse>

@Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.hsLink.hslink.data.dto.response.mypage

import kotlinx.serialization.Serializable

@Serializable
data class MyPageUserProfileDto(
val userId: Long,
val studentNumber: String,
val name: String,
val major: String,
val mentor: Boolean,
val jobSeeking: Boolean,
val academicStatus: String,
val careers: List<CareerItemDto>,
val links: List<LinkItemDto>
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.hsLink.hslink.data.dto.response.mypage

import kotlinx.serialization.Serializable


@Serializable
data class MyPageUserSummaryDto(
val userId: Long,
val name: String,
val studentNumberPrefix: String, // 학번 앞 두 자리 (예: "21")
val major: String,
val jobSeeking: Boolean,
val academicStatus: String, // <- String으로 변경
val employed: Boolean
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.hsLink.hslink.data.dto.response.mypage

import kotlinx.serialization.Serializable

@Serializable
data class ProfileUpdateResponse(
val isSuccess: Boolean,
val code: String,
val message: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.hsLink.hslink.data.repositoryimpl

import com.hsLink.hslink.data.dto.request.onboarding.CareerUpdateRequestDto
import com.hsLink.hslink.data.dto.response.onboarding.CareerDto
import com.hsLink.hslink.data.service.CareerService
import com.hsLink.hslink.domain.repository.CareerRepository
import javax.inject.Inject

class CareerRepositoryImpl @Inject constructor(
private val careerService: CareerService
) : CareerRepository {

override suspend fun getMyCareers(): Result<List<CareerDto>> {
return try {
val response = careerService.getMyCareers()
if (response.isSuccess) {
Result.success(response.result)
} else {
Result.failure(Exception(response.message))
}
} catch (e: Exception) {
Result.failure(e)
}
}

override suspend fun updateCareer(careerId: Long, request: CareerUpdateRequestDto): Result<CareerDto> {
return try {
val response = careerService.updateCareer(careerId, request)
if (response.isSuccess) {
Result.success(response.result)
} else {
Result.failure(Exception(response.message))
}
} catch (e: Exception) {
Result.failure(e)
}
}
override suspend fun getCareer(careerId: Long): Result<CareerDto> {
return try {
val response = careerService.getCareer(careerId)
if (response.isSuccess) {
Result.success(response.result)
} else {
Result.failure(Exception(response.message))
}
} catch (e: Exception) {
Result.failure(e)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// data/repositoryimpl/mypage/MypageRepositoryImpl.kt
package com.hsLink.hslink.data.repositoryimpl.mypage

import com.hsLink.hslink.data.dto.request.mypage.UpdateProfileRequestDto
import com.hsLink.hslink.data.dto.response.mypage.MyPageUserProfileDto
import com.hsLink.hslink.data.dto.response.mypage.MyPageUserSummaryDto
import com.hsLink.hslink.data.dto.response.mypage.UserProfileDto
import com.hsLink.hslink.data.service.mypage.MypageService
import com.hsLink.hslink.domain.repository.mypage.MypageRepository
import javax.inject.Inject

class MypageRepositoryImpl @Inject constructor(
private val mypageService: MypageService
) : MypageRepository {

override suspend fun getUserProfile(): Result<MyPageUserProfileDto> {
return try {
val response = mypageService.getUserProfile()
if (response.isSuccessful) {
response.body()?.let { baseResponse ->
if (baseResponse.isSuccess) {
Result.success(baseResponse.result)
} else {
Result.failure(Exception(baseResponse.message))
}
} ?: Result.failure(Exception("응답이 비어있습니다"))
} else {
Result.failure(Exception("API 호출 실패: ${response.code()}"))
}
} catch (e: Exception) {
Result.failure(e)
}
}

override suspend fun updateProfile(request: UpdateProfileRequestDto): Result<Unit> {
return try {
val response = mypageService.updateProfile(request)
if (response.isSuccess) {
Result.success(Unit)
} else {
Result.failure(Exception(response.message))
}
} catch (e: Exception) {
Result.failure(e)
}
}

override suspend fun getUserSummary(): Result<MyPageUserSummaryDto> {
return try {
val response = mypageService.getUserSummary()
if (response.isSuccess) {
Result.success(response.result)
} else {
Result.failure(Exception(response.message))
}
} catch (e: Exception) {
Result.failure(e)
}
}
}
27 changes: 27 additions & 0 deletions app/src/main/java/com/hsLink/hslink/data/service/CareerService.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// data/service/CareerService.kt
package com.hsLink.hslink.data.service

import com.hsLink.hslink.core.network.BaseResponse
import com.hsLink.hslink.data.dto.request.onboarding.CareerUpdateRequestDto
import com.hsLink.hslink.data.dto.response.onboarding.CareerDto
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.PUT
import retrofit2.http.Path

interface CareerService {

@GET("careers/mycareers")
suspend fun getMyCareers(): BaseResponse<List<CareerDto>>

@GET("careers/{careerId}")
suspend fun getCareer(
@Path("careerId") careerId: Long
): BaseResponse<CareerDto>

@PUT("careers/{careerId}")
suspend fun updateCareer(
@Path("careerId") careerId: Long,
@Body request: CareerUpdateRequestDto
): BaseResponse<CareerDto>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// data/service/mypage/MypageService.kt
package com.hsLink.hslink.data.service.mypage

import com.hsLink.hslink.core.network.BaseResponse
import com.hsLink.hslink.data.dto.request.mypage.UpdateProfileRequestDto
import com.hsLink.hslink.data.dto.response.mypage.MyPageUserProfileDto
import com.hsLink.hslink.data.dto.response.mypage.MyPageUserSummaryDto
import com.hsLink.hslink.data.dto.response.mypage.ProfileUpdateResponse
import com.hsLink.hslink.data.dto.response.mypage.UserProfileDto
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.PATCH

interface MypageService {
@GET("users/myprofile")
suspend fun getUserProfile(): Response<BaseResponse<MyPageUserProfileDto>>

@PATCH("users/myprofile")
suspend fun updateProfile(
@Body request: UpdateProfileRequestDto
): ProfileUpdateResponse

@GET("users/summary")
suspend fun getUserSummary(): BaseResponse<MyPageUserSummaryDto>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.hsLink.hslink.domain.repository

import com.hsLink.hslink.data.dto.request.onboarding.CareerUpdateRequestDto
import com.hsLink.hslink.data.dto.response.onboarding.CareerDto

interface CareerRepository {
suspend fun getCareer(careerId: Long): Result<CareerDto>
suspend fun getMyCareers(): Result<List<CareerDto>>
suspend fun updateCareer(careerId: Long, request: CareerUpdateRequestDto): Result<CareerDto>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// domain/repository/mypage/MypageRepository.kt
package com.hsLink.hslink.domain.repository.mypage

import com.hsLink.hslink.data.dto.request.mypage.UpdateProfileRequestDto
import com.hsLink.hslink.data.dto.response.mypage.MyPageUserProfileDto
import com.hsLink.hslink.data.dto.response.mypage.MyPageUserSummaryDto
import com.hsLink.hslink.data.dto.response.mypage.UserProfileDto

interface MypageRepository {
suspend fun getUserProfile(): Result<MyPageUserProfileDto>

suspend fun updateProfile(request: UpdateProfileRequestDto): Result<Unit>

suspend fun getUserSummary(): Result<MyPageUserSummaryDto>

}
Loading