-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/#69 home api response model #73
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| package com.chukchukhaksa.mobile.common.model.academic | ||
|
|
||
| data class AcademicRecord( | ||
| val courses: AcademicRecordCourses, | ||
| val semesterGrade: SemesterGrade | ||
| ) | ||
|
|
||
| data class AcademicRecordCourses( | ||
| val liberal: List<Liberal>, | ||
| val major: List<Major> | ||
| ) | ||
|
|
||
| data class SemesterGrade( | ||
| val attemptedCredits: Int, | ||
| val classRank: Int, | ||
| val earnedCredits: Int, | ||
| val percentile: Double, | ||
| val semester: Int, | ||
| val semesterGpa: Double, | ||
| val totalStudents: Int, | ||
| val year: Int | ||
| ) | ||
|
|
||
| data class Major( | ||
| val areaType: String, | ||
| val courseCode: String, | ||
| val courseName: String, | ||
| val credits: Int, | ||
| val grade: String, | ||
| val id: String, | ||
| val isOnline: Boolean, | ||
| val isRetake: Boolean, | ||
| val isRetakeDelete: Boolean, | ||
| val originalScore: Int, | ||
| val professor: String, | ||
| val score: Int, | ||
| val semester: Int, | ||
| val year: Int | ||
| ) | ||
|
|
||
| data class Liberal( | ||
| val areaType: String, | ||
| val courseCode: String, | ||
| val courseName: String, | ||
| val credits: Int, | ||
| val grade: String, | ||
| val id: String, | ||
| val isOnline: Boolean, | ||
| val isRetake: Boolean, | ||
| val isRetakeDelete: Boolean, | ||
| val originalScore: Int, | ||
| val professor: String, | ||
| val score: Int, | ||
| val semester: Int, | ||
| val year: Int | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.chukchukhaksa.mobile.common.model.academic | ||
|
|
||
| data class AcademicSummary( | ||
| val cumulativeGpa: Double, | ||
| val percentile: Double, | ||
| val requiredCredits: Int, | ||
| val totalEarnedCredits: Int | ||
| ) | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package com.chukchukhaksa.mobile.common.model.graduation | ||
|
|
||
| data class GraduationProcess( | ||
| val areaType: String, | ||
| val completedElectiveCourses: Int, | ||
| val courses: List<GraduationProcessCourse>, | ||
| val earnedCredits: Int, | ||
| val requiredCredits: Int, | ||
| val requiredElectiveCourses: Int, | ||
| val totalElectiveCourses: Int | ||
| ) | ||
|
|
||
| data class GraduationProcessCourse( | ||
| val courseName: String, | ||
| val credits: Int, | ||
| val grade: String, | ||
| val semester: Int, | ||
| val year: Int | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.chukchukhaksa.mobile.common.model.profile | ||
|
|
||
| data class Profile( | ||
| val name: String, | ||
| val studentCode: String, | ||
| val departmentName: String, | ||
| val majorName: String, | ||
| val gradeLevel: Int, | ||
| val currentSemester: Int, | ||
| val status : String, | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| package com.chukchukhaksa.mobile.common.model.response.academic | ||
|
|
||
| import com.chukchukhaksa.mobile.common.model.academic.AcademicRecord | ||
| import com.chukchukhaksa.mobile.common.model.academic.AcademicRecordCourses | ||
| import com.chukchukhaksa.mobile.common.model.academic.Liberal | ||
| import com.chukchukhaksa.mobile.common.model.academic.Major | ||
| import com.chukchukhaksa.mobile.common.model.academic.SemesterGrade | ||
|
|
||
| data class AcademicRecordResponse( | ||
| val data: AcademicRecordResponseData, | ||
| val message: String, | ||
| val success: Boolean | ||
| ) | ||
|
Comment on lines
+9
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๐งน Nitpick | ๐ต Trivial ์๋ต ๋ชจ๋ธ ๋ณํ ์ง์ ์ ์ ๋ฃจํธ์๋ ๋ง์ถฐ์ฃผ๋ ๊ฒ์ด ์ข์ต๋๋ค. ํ์ฌ๋ ๐ง ์ ์ ์์ ์ data class AcademicRecordResponse(
val data: AcademicRecordResponseData,
val message: String,
val success: Boolean
-)
+) {
+ fun toAcademicRecord() = data.toAcademicRecord()
+}๐ค Prompt for AI Agents |
||
|
|
||
| data class AcademicRecordResponseData( | ||
| val courses: AcademicRecordCoursesData, | ||
| val semesterGrade: SemesterGradeData | ||
| ) { | ||
| fun toAcademicRecord() = AcademicRecord( | ||
| courses = courses.toAcademicRecordCourses(), | ||
| semesterGrade = semesterGrade.toSemesterGrade() | ||
| ) | ||
| } | ||
|
|
||
| data class AcademicRecordCoursesData( | ||
| val liberal: List<LiberalData>, | ||
| val major: List<MajorData> | ||
| ) { | ||
| fun toAcademicRecordCourses() = AcademicRecordCourses( | ||
| liberal = liberal.map { it.toLiberal() }, | ||
| major = major.map { it.toMajor() } | ||
| ) | ||
| } | ||
|
|
||
|
|
||
| data class SemesterGradeData( | ||
| val attemptedCredits: Int, | ||
| val classRank: Int, | ||
| val earnedCredits: Int, | ||
| val percentile: Double, | ||
| val semester: Int, | ||
| val semesterGpa: Double, | ||
| val totalStudents: Int, | ||
| val year: Int | ||
| ) { | ||
| fun toSemesterGrade() = SemesterGrade( | ||
| attemptedCredits = attemptedCredits, | ||
| classRank = classRank, | ||
| earnedCredits = earnedCredits, | ||
| percentile = percentile, | ||
| semester = semester, | ||
| semesterGpa = semesterGpa, | ||
| totalStudents = totalStudents, | ||
| year = year, | ||
| ) | ||
| } | ||
|
|
||
| data class MajorData( | ||
| val areaType: String, | ||
| val courseCode: String, | ||
| val courseName: String, | ||
| val credits: Int, | ||
| val grade: String, | ||
| val id: String, | ||
| val isOnline: Boolean, | ||
| val isRetake: Boolean, | ||
| val isRetakeDelete: Boolean, | ||
| val originalScore: Int, | ||
| val professor: String, | ||
| val score: Int, | ||
| val semester: Int, | ||
| val year: Int | ||
| ) { | ||
| fun toMajor() = Major( | ||
| areaType = areaType, | ||
| courseCode = courseCode, | ||
| courseName = courseName, | ||
| credits = credits, | ||
| grade = grade, | ||
| id = id, | ||
| isOnline = isOnline, | ||
| isRetake = isRetake, | ||
| isRetakeDelete = isRetakeDelete, | ||
| originalScore = originalScore, | ||
| professor = professor, | ||
| score = score, | ||
| semester = semester, | ||
| year = year, | ||
| ) | ||
| } | ||
|
|
||
| data class LiberalData( | ||
| val areaType: String, | ||
| val courseCode: String, | ||
| val courseName: String, | ||
| val credits: Int, | ||
| val grade: String, | ||
| val id: String, | ||
| val isOnline: Boolean, | ||
| val isRetake: Boolean, | ||
| val isRetakeDelete: Boolean, | ||
| val originalScore: Int, | ||
| val professor: String, | ||
| val score: Int, | ||
| val semester: Int, | ||
| val year: Int | ||
| ) { | ||
| fun toLiberal() = Liberal( | ||
| areaType = areaType, | ||
| courseCode = courseCode, | ||
| courseName = courseName, | ||
| credits = credits, | ||
| grade = grade, | ||
| id = id, | ||
| isOnline = isOnline, | ||
| isRetake = isRetake, | ||
| isRetakeDelete = isRetakeDelete, | ||
| originalScore = originalScore, | ||
| professor = professor, | ||
| score = score, | ||
| semester = semester, | ||
| year = year, | ||
| ) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package com.chukchukhaksa.mobile.common.model.response.academic | ||
|
|
||
| import com.chukchukhaksa.mobile.common.model.academic.AcademicSummary | ||
|
|
||
| data class AcademicSummaryResponse( | ||
| val data: AcademicSummaryResponseData, | ||
| val message: String, | ||
| val success: Boolean | ||
| ) | ||
|
Comment on lines
+5
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๐งฉ Analysis chain๐ Script executed: # Search for `@Serializable` usage in Response models
echo "=== Checking for `@Serializable` in Response models ==="
rg -n "@Serializable" --type=kt composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile -A 2 | head -50
# Check other Response models in the same academic directory
echo -e "\n=== Response models in academic directory ==="
fd "Response\.kt$" composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile/common/model/response/academic/
# Check general Response model directory
echo -e "\n=== Response files in response directory ==="
find composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile/common/model/response -name "*.kt" -type f | head -20Repository: cchaksa/cchaksa-app Length of output: 1174 ๐ Script executed: # Let's examine a few Response model files to understand the pattern
echo "=== Examining AcademicSummaryResponse ==="
cat -n composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile/common/model/response/academic/AcademicSummaryResponse.kt
echo -e "\n=== Examining AcademicSummaryResponseData ==="
fd "AcademicSummaryResponseData\.kt$" -x cat -nRepository: cchaksa/cchaksa-app Length of output: 944 ๐ Script executed: # Check if there's a serialization configuration file or setup
echo "=== Checking for serialization setup ==="
rg -n "kotlinx.serialization|Json|Serializable" --type=kt composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile/common/model/response -A 1 | head -40Repository: cchaksa/cchaksa-app Length of output: 147 ๐ Script executed: # Examine other Response models
echo "=== ProfileResponse ==="
cat -n composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile/common/model/response/profile/ProfileResponse.kt
echo -e "\n=== SemesterListResponse ==="
cat -n composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile/common/model/response/semester/SemesterListResponse.kt
echo -e "\n=== AcademicRecordResponse ==="
cat -n composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile/common/model/response/academic/AcademicRecordResponse.ktRepository: cchaksa/cchaksa-app Length of output: 5817 ๐ Script executed: # Check for serialization library setup in build files
echo "=== Checking gradle for serialization ==="
find composeApp -name "build.gradle*" -o -name "*.gradle.kts" | xargs grep -l "serialization\|json" 2>/dev/null | head -5
# Check where API responses are deserialized
echo -e "\n=== Searching for Json parsing/deserialization logic ==="
rg "Json\.|Json\.decode\|parseJson\|fromJson" --type-add="kt:*.kt" composeApp/src/commonMain/kotlin -A 2 | head -50Repository: cchaksa/cchaksa-app Length of output: 5412 ๐ Script executed: # Check for HTTP client usage and serialization
echo "=== Checking for HTTP client setup ==="
rg "HttpClient\|Ktor\|Retrofit" --type-add="kt:*.kt" composeApp/src/commonMain/kotlin -B 1 -A 1 | head -40Repository: cchaksa/cchaksa-app Length of output: 101 ๐ Script executed: # Check the build.gradle.kts for serialization configuration
cat -n composeApp/build.gradle.kts | head -100Repository: cchaksa/cchaksa-app Length of output: 3981 ๐ Script executed: # Check if there's a custom Json setup that might handle serialization without `@Serializable`
echo "=== Checking common Json configuration ==="
cat -n composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile/common/ui/Json.kt
# Check for `@Serializable` in common/ui directory
echo -e "\n=== Checking for `@Serializable` setup ==="
find composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile/common -name "*.kt" | xargs grep -l "@Serializable" | head -10Repository: cchaksa/cchaksa-app Length of output: 1590 ๐ Script executed: # Check how API responses are deserialized - look for HTTP client/API service
echo "=== Searching for API service or HTTP client configuration ==="
fd "Api.kt|Service.kt|Client.kt" composeApp/src/commonMain/kotlin -x cat -n
echo -e "\n=== Checking for Ktor HTTP client ==="
rg "HttpClient|createHttpClient|httpClient" --type-add="kt:*.kt" composeApp/src/commonMain -B 2 -A 5 | head -60Repository: cchaksa/cchaksa-app Length of output: 850 ๐ Script executed: # Check one of the models that has `@Serializable` to see the pattern
echo "=== Checking OpenLecture.kt with `@Serializable` ==="
cat -n composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile/common/model/OpenLecture.kt
echo -e "\n=== Checking Timetable.kt with `@Serializable` ==="
head -20 composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile/common/model/Timetable.ktRepository: cchaksa/cchaksa-app Length of output: 1328 Response ๋ชจ๋ธ์ ์ด ํ๋ก์ ํธ๋ ๐ค Prompt for AI Agents |
||
|
|
||
| data class AcademicSummaryResponseData( | ||
| val cumulativeGpa: Double, | ||
| val percentile: Double, | ||
| val requiredCredits: Int, | ||
| val totalEarnedCredits: Int | ||
| ) { | ||
| fun toAcademicSummary() = AcademicSummary( | ||
| cumulativeGpa = cumulativeGpa, | ||
| percentile = percentile, | ||
| requiredCredits = requiredCredits, | ||
| totalEarnedCredits = totalEarnedCredits, | ||
| ) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,51 @@ | ||||||||||||||||||||||
| package com.chukchukhaksa.mobile.common.model.response.graduation | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| import com.chukchukhaksa.mobile.common.model.graduation.GraduationProcess | ||||||||||||||||||||||
| import com.chukchukhaksa.mobile.common.model.graduation.GraduationProcessCourse | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| data class GraduationProcessResponse( | ||||||||||||||||||||||
| val data: GraduationProcessResponseData, | ||||||||||||||||||||||
| val message: String, | ||||||||||||||||||||||
| val success: Boolean | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
|
Comment on lines
+6
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๐งน Nitpick | ๐ต Trivial ๋ค์ฌ์ฐ๊ธฐ ๋ถ์ผ์น
โป๏ธ ๋ค์ฌ์ฐ๊ธฐ ์์ ์ ์ data class GraduationProcessResponse(
- val data: GraduationProcessResponseData,
- val message: String,
- val success: Boolean
+ val data: GraduationProcessResponseData,
+ val message: String,
+ val success: Boolean
)๐ Committable suggestion
Suggested change
๐ค Prompt for AI Agents |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| data class GraduationProcessResponseData( | ||||||||||||||||||||||
| val graduationProgress: List<GraduationProgressData>, | ||||||||||||||||||||||
| val hasDifferentGraduationRequirement: Boolean | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| data class GraduationProgressData( | ||||||||||||||||||||||
| val areaType: String, | ||||||||||||||||||||||
| val completedElectiveCourses: Int, | ||||||||||||||||||||||
| val courses: List<GraduationProcessCourseData>, | ||||||||||||||||||||||
| val earnedCredits: Int, | ||||||||||||||||||||||
| val requiredCredits: Int, | ||||||||||||||||||||||
| val requiredElectiveCourses: Int, | ||||||||||||||||||||||
| val totalElectiveCourses: Int | ||||||||||||||||||||||
| ) { | ||||||||||||||||||||||
| fun toGraduationProcess() = GraduationProcess( | ||||||||||||||||||||||
| areaType = areaType, | ||||||||||||||||||||||
| completedElectiveCourses = completedElectiveCourses, | ||||||||||||||||||||||
| courses = courses.map { it.toGraduationProcessCourse() }, | ||||||||||||||||||||||
| earnedCredits = earnedCredits, | ||||||||||||||||||||||
| requiredCredits = requiredCredits, | ||||||||||||||||||||||
| requiredElectiveCourses = requiredElectiveCourses, | ||||||||||||||||||||||
| totalElectiveCourses = totalElectiveCourses, | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| data class GraduationProcessCourseData( | ||||||||||||||||||||||
| val courseName: String, | ||||||||||||||||||||||
| val credits: Int, | ||||||||||||||||||||||
| val grade: String, | ||||||||||||||||||||||
| val semester: Int, | ||||||||||||||||||||||
| val year: Int | ||||||||||||||||||||||
| ) { | ||||||||||||||||||||||
| fun toGraduationProcessCourse() = GraduationProcessCourse( | ||||||||||||||||||||||
| courseName = courseName, | ||||||||||||||||||||||
| credits = credits, | ||||||||||||||||||||||
| grade = grade, | ||||||||||||||||||||||
| semester = semester, | ||||||||||||||||||||||
| year = year, | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
Comment on lines
+6
to
+51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๐งฉ Analysis chain๐ Script executed: # First, let's check the full content of the file in question
cat -n "composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile/common/model/response/graduation/GraduationProcessResponse.kt"Repository: cchaksa/cchaksa-app Length of output: 1905 ๐ Script executed: # Search for `@Serializable` annotations in other response models
rg -l "@Serializable" --type=kotlin "composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile/" | head -20Repository: cchaksa/cchaksa-app Length of output: 799 ๐ Script executed: # Check for other response model patterns
fd "Response\.kt$" "composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile/" | head -10Repository: cchaksa/cchaksa-app Length of output: 752 ๐ Script executed: # Check for serialization library setup in build files
fd "build\.gradle|build\.gradle\.kts" | xargs grep -l "serialization\|gson\|moshi" 2>/dev/nullRepository: cchaksa/cchaksa-app Length of output: 90 ๐ Script executed: # Search for actual serialization annotations in the project
rg "@Serializable|@SerializedName|@Json" --type=kotlin "composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile/" | head -20Repository: cchaksa/cchaksa-app Length of output: 1134 ๐ Script executed: # Check if other response models have `@Serializable` annotations
cat -n "composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile/common/model/response/profile/ProfileResponse.kt" 2>/dev/null | head -30Repository: cchaksa/cchaksa-app Length of output: 1044 ๐ Script executed: # Check another response model
cat -n "composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile/common/model/response/academic/AcademicRecordResponse.kt" 2>/dev/null | head -30Repository: cchaksa/cchaksa-app Length of output: 1286 ๐ Script executed: # Check build.gradle.kts for serialization setup
grep -A5 -B5 "serialization\|kotlinx" "composeApp/build.gradle.kts" | head -50Repository: cchaksa/cchaksa-app Length of output: 881 ๐ Script executed: # Check if any response models use `@Serializable`
rg "@Serializable" --type=kotlin "composeApp/src/commonMain/kotlin/com/chukchukhaksa/mobile/common/model/response/"Repository: cchaksa/cchaksa-app Length of output: 45 ์ง๋ ฌํ ์ด๋ ธํ ์ด์ ์ถ๊ฐ ํ์ API ์๋ต ๋ชจ๋ธ์์ `@Serializable`
data class GraduationProcessResponse(...)
`@Serializable`
data class GraduationProcessResponseData(...)
`@Serializable`
data class GraduationProgressData(...)
`@Serializable`
data class GraduationProcessCourseData(...)๐ค Prompt for AI Agents |
||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package com.chukchukhaksa.mobile.common.model.response.profile | ||
|
|
||
| import com.chukchukhaksa.mobile.common.model.profile.Profile | ||
|
|
||
| data class ProfileResponse( | ||
| val success: Boolean, | ||
| val data: ProfileResponseData, | ||
| val message: String, | ||
| ) | ||
|
|
||
| data class ProfileResponseData( | ||
| val name: String, | ||
| val studentCode: String, | ||
| val departmentName: String, | ||
| val majorName: String, | ||
| val gradeLevel: Int, | ||
| val currentSemester: Int, | ||
| val status : String, | ||
| val lastUpdatedAt: String, | ||
| val lastSyncedAt : String, | ||
| val reconnectionRequired: Boolean | ||
| ) { | ||
| fun toProfile() = Profile( | ||
| name = name, | ||
| studentCode = studentCode, | ||
| departmentName = departmentName, | ||
| majorName = majorName, | ||
| gradeLevel = gradeLevel, | ||
| currentSemester = currentSemester, | ||
| status = status | ||
| ) | ||
|
Comment on lines
+23
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๐งน Nitpick | ๐ต Trivial ๋งคํ์์ ์ ์ธ๋ ํ๋ ๊ฒํ
ํด๋น ํ๋๋ค์ด ์๋์ ์ผ๋ก ์ ์ธ๋ ๊ฒ์ธ์ง, ๋๋ ๋ณ๋์ ์ํ ๊ด๋ฆฌ๋ฅผ ํตํด ์ฒ๋ฆฌ๋๋์ง ํ์ธํด ์ฃผ์ธ์. ๐ค Prompt for AI Agents |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| package com.chukchukhaksa.mobile.common.model.response.semester | ||
|
|
||
| import com.chukchukhaksa.mobile.common.model.semester.SemesterGrades | ||
| import com.chukchukhaksa.mobile.common.model.semester.SemesterGradesList | ||
|
|
||
| data class SemesterGradesListResponse( | ||
| val data: List<SemesterGradesData>, | ||
| val message: String, | ||
| val success: Boolean | ||
| ) { | ||
| fun toSemesterGradesList() = SemesterGradesList( | ||
| semesterGradesList = data.map { it.toSemesterGrades() } | ||
| ) | ||
|
Comment on lines
+11
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์คํจ ์๋ต๋ ์ ์ ๋ชจ๋ธ๋ก ๋ณํ๋๋ ๊ฒฝ๋ก๋ฅผ ์ฐจ๋จํด์ผ ํฉ๋๋ค. Line 11-13์์ ๐ง ์ ์ ์์ ์ data class SemesterGradesListResponse(
val data: List<SemesterGradesData>,
val message: String,
val success: Boolean
) {
- fun toSemesterGradesList() = SemesterGradesList(
- semesterGradesList = data.map { it.toSemesterGrades() }
- )
+ fun toSemesterGradesList(): SemesterGradesList {
+ require(success) { "Semester grades API failed: $message" }
+ return SemesterGradesList(
+ semesterGradesList = data.map { it.toSemesterGrades() },
+ )
+ }
}๐ค Prompt for AI Agents |
||
| } | ||
|
|
||
| data class SemesterGradesData( | ||
| val attemptedCredits: Int, | ||
| val classRank: Int, | ||
| val earnedCredits: Int, | ||
| val percentile: Double, | ||
| val semester: Int, | ||
| val semesterGpa: Double, | ||
| val totalStudents: Int, | ||
| val year: Int | ||
| ) { | ||
| fun toSemesterGrades() = SemesterGrades( | ||
| attemptedCredits = attemptedCredits, | ||
| classRank = classRank, | ||
| earnedCredits = earnedCredits, | ||
| percentile = percentile, | ||
| semester = semester, | ||
| semesterGpa = semesterGpa, | ||
| totalStudents = totalStudents, | ||
| year = year, | ||
| ) | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,24 @@ | ||||||||||||||||||||
| package com.chukchukhaksa.mobile.common.model.response.semester | ||||||||||||||||||||
|
|
||||||||||||||||||||
| import com.chukchukhaksa.mobile.common.model.semester.SemesterList | ||||||||||||||||||||
| import com.chukchukhaksa.mobile.presentation.timetable.semesterselect.Semester | ||||||||||||||||||||
|
|
||||||||||||||||||||
| data class SemesterListResponse( | ||||||||||||||||||||
| val data: List<SemesterData>, | ||||||||||||||||||||
| val message: String, | ||||||||||||||||||||
| val success: Boolean | ||||||||||||||||||||
| ) { | ||||||||||||||||||||
| fun toSemesterList() = SemesterList( | ||||||||||||||||||||
| semesterList = data.map { it.toSemester() } | ||||||||||||||||||||
| ) | ||||||||||||||||||||
|
Comment on lines
+11
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์คํจ ์๋ต์ ์ ์ ๋ฐ์ดํฐ๋ก ๋งคํํ ์ํ์ด ์์ต๋๋ค Line 11~13์ ๊ถ์ฅ ์์ ์์ (fail-fast)- fun toSemesterList() = SemesterList(
- semesterList = data.map { it.toSemester() }
- )
+ fun toSemesterList(): SemesterList {
+ require(success) { "Failed to map SemesterListResponse: $message" }
+ return SemesterList(
+ semesterList = data.map { it.toSemester() }
+ )
+ }๐ Committable suggestion
Suggested change
๐ค Prompt for AI Agents |
||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| data class SemesterData( | ||||||||||||||||||||
| val semester: Int, | ||||||||||||||||||||
| val year: Int | ||||||||||||||||||||
| ) { | ||||||||||||||||||||
| fun toSemester() = Semester( | ||||||||||||||||||||
| semester = semester.toString(), | ||||||||||||||||||||
| year = year.toString(), | ||||||||||||||||||||
| ) | ||||||||||||||||||||
| } | ||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐งน Nitpick | ๐ต Trivial
Major/Liberal๋ชจ๋ธ ์ค๋ณต์ ์ค์ด๋ ๋ฆฌํฉํฐ๋ง์ด ํ์ํฉ๋๋ค.Line 24-56์ ํ๋๊ฐ 100% ๋์ผํด์ ๋ณ๊ฒฝ ๋๋ฝ ์ํ์ด ํฝ๋๋ค. ๊ณตํต
Course๋ชจ๋ธ๋ก ํตํฉํ๊ณ ๋ฆฌ์คํธ๋ง ๊ตฌ๋ถํ๋ ๊ตฌ์กฐ๊ฐ ์ ์ง๋ณด์์ ์ ๋ฆฌํฉ๋๋ค.โป๏ธ ๊ตฌ์กฐ ๋จ์ํ ์์
๐ค Prompt for AI Agents