Skip to content
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

강의동 Mock Data 추가 #212

Merged
merged 5 commits into from
Jan 22, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ object SugangSnuClassTimeUtils {
place = locationTexts.joinToString("/"),
startMinute = sugangSnuClassTime.startHour.toInt() * 60 + sugangSnuClassTime.startMinute.toInt(),
endMinute = sugangSnuClassTime.endHour.toInt() * 60 + sugangSnuClassTime.endMinute.toInt(),
lectureBuilding = null
)
}
.sortedWith(compareBy({ it.day.value }, { it.startMinute }))
Expand Down
7 changes: 7 additions & 0 deletions core/src/main/kotlin/lecturehalls/data/Campus.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.wafflestudio.snu4t.lecturehalls.data

enum class Campus {
GWANAK,
YEONGEON,
PYEONGCHANG,
}
6 changes: 6 additions & 0 deletions core/src/main/kotlin/lecturehalls/data/GeoCoordinate.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.wafflestudio.snu4t.lecturehalls.data

class GeoCoordinate(
val latitude: Double,
val longitude: Double
)
28 changes: 28 additions & 0 deletions core/src/main/kotlin/lecturehalls/data/LectureBuilding.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.wafflestudio.snu4t.lecturehalls.data

import org.springframework.data.annotation.Id
import org.springframework.data.mongodb.core.mapping.Document

@Document
data class LectureBuilding(
@Id
val id: String? = null,

// 동
val buildingNumber: String,

// 건물 이름(한국어) - 자연과학대학(500)
val buildingNameKor: String? = null,

// 건물 이름(영어) - College of Natural Sciences(500)
val buildingNameEng: String? = null,

// 위경도 - 37.4592190840394, 126.948120067187
val locationInDMS: GeoCoordinate,

// 위경도(십진표기) - 488525, 1099948
val locationInDecimal: GeoCoordinate,

// 캠퍼스 - 관악
val campus: Campus,
)
2 changes: 2 additions & 0 deletions core/src/main/kotlin/lectures/data/ClassPlaceAndTime.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.wafflestudio.snu4t.lectures.data

import com.wafflestudio.snu4t.common.enum.DayOfWeek
import com.wafflestudio.snu4t.lecturehalls.data.LectureBuilding

data class ClassPlaceAndTime(
val day: DayOfWeek,
val place: String,
val startMinute: Int,
val endMinute: Int,
var lectureBuilding: LectureBuilding?
)
16 changes: 16 additions & 0 deletions core/src/main/kotlin/lectures/dto/ClassPlaceAndTimeDto.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ package com.wafflestudio.snu4t.lectures.dto

import com.fasterxml.jackson.annotation.JsonProperty
import com.wafflestudio.snu4t.common.enum.DayOfWeek
import com.wafflestudio.snu4t.lecturehalls.data.Campus
import com.wafflestudio.snu4t.lecturehalls.data.GeoCoordinate
import com.wafflestudio.snu4t.lecturehalls.data.LectureBuilding
import com.wafflestudio.snu4t.lectures.data.ClassPlaceAndTime
import com.wafflestudio.snu4t.lectures.utils.endPeriod
import com.wafflestudio.snu4t.lectures.utils.minuteToString
import com.wafflestudio.snu4t.lectures.utils.startPeriod
import org.bson.types.ObjectId

data class ClassPlaceAndTimeDto(
val day: DayOfWeek,
Expand Down Expand Up @@ -34,6 +38,7 @@ data class ClassPlaceAndTimeLegacyDto(
val periodLength: Double,
@JsonProperty("start")
val startPeriod: Double,
val lectureBuilding: LectureBuilding?
)

fun ClassPlaceAndTimeLegacyDto(classPlaceAndTime: ClassPlaceAndTime): ClassPlaceAndTimeLegacyDto = ClassPlaceAndTimeLegacyDto(
Expand All @@ -45,4 +50,15 @@ fun ClassPlaceAndTimeLegacyDto(classPlaceAndTime: ClassPlaceAndTime): ClassPlace
endTime = minuteToString(classPlaceAndTime.endMinute),
startPeriod = classPlaceAndTime.startPeriod,
periodLength = classPlaceAndTime.endPeriod - classPlaceAndTime.startPeriod,
lectureBuilding = MockLectureBuilding()
)

private fun MockLectureBuilding() = LectureBuilding(
id = ObjectId.get().toHexString(),
buildingNumber = "500",
buildingNameKor = "자연과학대학(500)",
buildingNameEng = "College of Natural Sciences(500)",
locationInDMS = GeoCoordinate(37.4592190840394, 126.94812006718699),
locationInDecimal = GeoCoordinate(488525.0, 1099948.0),
campus = Campus.GWANAK
)
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ data class ClassPlaceAndTimeLegacyRequestDto(
day = day,
place = place ?: "",
startMinute = startMinute,
endMinute = endMinute
endMinute = endMinute,
lectureBuilding = null
)
}

Expand Down
Loading