Skip to content

Commit dbc5fd1

Browse files
authored
Merge pull request #402 from GSM-MSG/feature/401-mypage-field-sync
portfolioUrl 필수값으로 응답하도록 수정
2 parents d3dd0e6 + 8a928ec commit dbc5fd1

File tree

9 files changed

+35
-9
lines changed

9 files changed

+35
-9
lines changed

sms-core/src/main/kotlin/team/msg/sms/domain/student/dto/res/DetailStudentInfoTeacherResponseData.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import team.msg.sms.domain.student.model.MilitaryService
1010
data class DetailStudentInfoTeacherResponseData(
1111
val name: String,
1212
val introduce: String,
13-
val portfolioUrl: String?,
13+
val portfolioUrl: String,
1414
val portfolioFileUrl: String?,
1515
val grade: Int,
1616
val classNum: Int,

sms-core/src/main/kotlin/team/msg/sms/domain/student/dto/res/DetailStudentInfoTokenResponseData.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import team.msg.sms.domain.student.model.MilitaryService
1010
data class DetailStudentInfoTokenResponseData(
1111
val name: String,
1212
val introduce: String,
13-
val portfolioUrl: String?,
13+
val portfolioUrl: String,
1414
val portfolioFileUrl: String?,
1515
val grade: Int,
1616
val classNum: Int,

sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/ModifyStudentInfoUseCase.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class ModifyStudentInfoUseCase(
7171
val checkStudentMismatch = studentService.checkStudentDataMismatch(student, modifyStudentInfoDataModel)
7272
if (checkStudentMismatch) {
7373
val portfolioFileUrl =
74-
if(student.portfolioUrl != modifyStudentInfoDataModel.portfolioUrl
74+
if(student.portfolioUrl != modifyStudentInfoDataModel.portfolioUrl // true && true) //해당 데이터가 다르면서 수정 데이터는 있으면 null
7575
&& modifyStudentInfoData.portfolioUrl != null) null
7676
else student.portfolioFileUrl
7777

@@ -299,6 +299,7 @@ class ModifyStudentInfoUseCase(
299299
}
300300

301301
else -> when (departmentCode) {
302+
"0" -> Department.SW_DEVELOPMENT
302303
"1", "2" -> Department.SW_DEVELOPMENT
303304
"3", "4" -> Department.SMART_IOT_DEVELOPMENT
304305
else -> throw StuNumNotRightException

sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoTeacherUseCase.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import team.msg.sms.domain.project.service.ProjectService
1313
import team.msg.sms.domain.project.service.ProjectTechStackService
1414
import team.msg.sms.domain.region.service.RegionService
1515
import team.msg.sms.domain.student.dto.res.DetailStudentInfoTeacherResponseData
16+
import team.msg.sms.domain.student.model.Student
1617
import team.msg.sms.domain.student.model.StudentTechStack
1718
import team.msg.sms.domain.student.service.StudentService
1819
import team.msg.sms.domain.student.service.StudentTechStackService
@@ -48,7 +49,7 @@ class StudentInfoTeacherUseCase(
4849
return DetailStudentInfoTeacherResponseData(
4950
name = student.name,
5051
introduce = student.introduce,
51-
portfolioUrl = student.portfolioUrl,
52+
portfolioUrl = getStudentPortfolioUrl(student),
5253
portfolioFileUrl = student.portfolioFileUrl,
5354
grade = student.stuNum.substring(0, 1).toInt(),
5455
classNum = student.stuNum.substring(1, 2).toInt(),
@@ -90,5 +91,13 @@ class StudentInfoTeacherUseCase(
9091

9192
private fun toStudentTechStacks(techStacks: List<TechStack>, studentTechStack: StudentTechStack): TechStack? =
9293
techStacks.find { it.id == studentTechStack.techStackId }
94+
95+
private fun getStudentPortfolioUrl(student: Student.StudentWithUserInfo): String {
96+
return when {
97+
!student.portfolioUrl.isNullOrBlank() -> student.portfolioUrl
98+
!student.portfolioFileUrl.isNullOrBlank() -> student.portfolioFileUrl
99+
else -> ""
100+
}
101+
}
93102
}
94103

sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoTokenUseCase.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class StudentInfoTokenUseCase(
5252
return DetailStudentInfoTokenResponseData(
5353
name = student.name,
5454
introduce = student.introduce,
55-
portfolioUrl = student.portfolioUrl,
55+
portfolioUrl = getStudentPortfolioUrl(student),
5656
portfolioFileUrl = student.portfolioFileUrl,
5757
grade = student.stuNum.substring(0, 1).toInt(),
5858
classNum = student.stuNum.substring(1, 2).toInt(),
@@ -94,5 +94,13 @@ class StudentInfoTokenUseCase(
9494

9595
private fun toStudentTechStacks(techStacks: List<TechStack>, studentTechStack: StudentTechStack): TechStack? =
9696
techStacks.find { it.id == studentTechStack.techStackId }
97+
98+
private fun getStudentPortfolioUrl(student: Student.StudentWithUserInfo): String {
99+
return when {
100+
!student.portfolioUrl.isNullOrBlank() -> student.portfolioUrl
101+
!student.portfolioFileUrl.isNullOrBlank() -> student.portfolioFileUrl
102+
else -> ""
103+
}
104+
}
97105
}
98106

sms-core/src/main/kotlin/team/msg/sms/domain/user/dto/res/UserProfileDetailResponseData.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import team.msg.sms.domain.student.model.MilitaryService
1010
data class UserProfileDetailResponseData(
1111
val name: String,
1212
val introduce: String,
13-
val portfolioUrl: String?,
13+
val portfolioUrl: String,
1414
val portfolioFileUrl: String?,
1515
val grade: Int,
1616
val classNum: Int,

sms-core/src/main/kotlin/team/msg/sms/domain/user/usecase/QueryCurrentUserProfileDetailUseCase.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class QueryCurrentUserProfileDetailUseCase(
7373
UserProfileDetailResponseData(
7474
name = student.name,
7575
introduce = student.introduce,
76-
portfolioUrl = student.portfolioUrl,
76+
portfolioUrl = getStudentPortfolioUrl(student),
7777
portfolioFileUrl = student.portfolioFileUrl,
7878
grade = student.stuNum.substring(0, 1).toInt(),
7979
classNum = student.stuNum.substring(1, 2).toInt(),
@@ -113,4 +113,12 @@ class QueryCurrentUserProfileDetailUseCase(
113113

114114
private fun toStudentTechStacks(techStacks: List<TechStack>, studentTechStack: StudentTechStack): TechStack? =
115115
techStacks.find { it.id == studentTechStack.techStackId }
116+
117+
private fun getStudentPortfolioUrl(student: Student.StudentWithUserInfo): String {
118+
return when {
119+
!student.portfolioUrl.isNullOrBlank() -> student.portfolioUrl
120+
!student.portfolioFileUrl.isNullOrBlank() -> student.portfolioFileUrl
121+
else -> ""
122+
}
123+
}
116124
}

sms-presentation/src/main/kotlin/team/msg/sms/domain/student/dto/res/DetailStudentInfoTeacherWebResponse.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import team.msg.sms.domain.student.model.MilitaryService
1010
data class DetailStudentInfoTeacherWebResponse(
1111
val name: String,
1212
val introduce: String,
13-
val portfolioUrl: String?,
13+
val portfolioUrl: String,
1414
val portfolioFileUrl: String?,
1515
val grade: Int,
1616
val classNum: Int,

sms-presentation/src/main/kotlin/team/msg/sms/domain/student/dto/res/DetailStudentInfoTokenWebResponse.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import team.msg.sms.domain.student.model.MilitaryService
1010
data class DetailStudentInfoTokenWebResponse(
1111
val name: String,
1212
val introduce: String,
13-
val portfolioUrl: String?,
13+
val portfolioUrl: String,
1414
val portfolioFileUrl: String?,
1515
val grade: Int,
1616
val classNum: Int,

0 commit comments

Comments
 (0)