-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from Kusitms-29th-ASAP/feature/tranlate/timet…
…able feat: 시간표 도메인 번역 추가
- Loading branch information
Showing
21 changed files
with
439 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 19 additions & 13 deletions
32
src/main/kotlin/com/asap/asapbackend/domain/timetable/domain/model/Subject.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,32 @@ | ||
package com.asap.asapbackend.domain.timetable.domain.model | ||
|
||
import com.asap.asapbackend.domain.classroom.domain.model.Classroom | ||
import com.asap.asapbackend.global.domain.BaseDateEntity | ||
import jakarta.persistence.Entity | ||
import jakarta.persistence.FetchType | ||
import jakarta.persistence.ManyToOne | ||
import java.time.LocalDateTime | ||
|
||
@Entity | ||
class Subject( | ||
classroom: Classroom, | ||
id: Long = 0, | ||
classroomId: Long, | ||
name: String, | ||
semester: String | ||
) : BaseDateEntity() { | ||
semester: String, | ||
createdAt: LocalDateTime = LocalDateTime.now(), | ||
updatedAt: LocalDateTime = LocalDateTime.now() | ||
) { | ||
val id: Long = id | ||
|
||
val name : String = name | ||
|
||
val semester : String = semester | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
val classroom: Classroom = classroom | ||
val classroomId: Long = classroomId | ||
|
||
fun isSameSubject(subject: Subject): Boolean { | ||
return this.name == subject.name && this.semester == subject.semester && this.classroom.id == subject.classroom.id | ||
val createdAt: LocalDateTime = createdAt | ||
val updatedAt: LocalDateTime = updatedAt | ||
|
||
|
||
fun isSameSubject( | ||
name: String, | ||
semester: String, | ||
classroomId: Long | ||
): Boolean { | ||
return this.name == name && this.semester == semester && this.classroomId == classroomId | ||
} | ||
} |
18 changes: 10 additions & 8 deletions
18
src/main/kotlin/com/asap/asapbackend/domain/timetable/domain/model/Timetable.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
package com.asap.asapbackend.domain.timetable.domain.model | ||
|
||
import com.asap.asapbackend.global.domain.BaseDateEntity | ||
import jakarta.persistence.Entity | ||
import jakarta.persistence.FetchType | ||
import jakarta.persistence.ManyToOne | ||
import java.time.LocalDate | ||
import java.time.LocalDateTime | ||
|
||
@Entity | ||
class Timetable( | ||
id: Long = 0, | ||
subject: Subject, | ||
day: LocalDate, | ||
time: Int | ||
) : BaseDateEntity() { | ||
time: Int, | ||
createdAt: LocalDateTime = LocalDateTime.now(), | ||
updatedAt: LocalDateTime = LocalDateTime.now() | ||
) { | ||
val id: Long = id | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
val subject: Subject = subject | ||
|
||
val day: LocalDate = day | ||
|
||
val time: Int = time | ||
|
||
val createdAt: LocalDateTime = createdAt | ||
val updatedAt: LocalDateTime = updatedAt | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
...kotlin/com/asap/asapbackend/domain/timetable/domain/repository/TimetableJdbcRepository.kt
This file was deleted.
Oops, something went wrong.
7 changes: 4 additions & 3 deletions
7
...ain/kotlin/com/asap/asapbackend/domain/timetable/domain/repository/TimetableRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
package com.asap.asapbackend.domain.timetable.domain.repository | ||
|
||
import com.asap.asapbackend.domain.timetable.domain.model.Timetable | ||
import org.springframework.data.jpa.repository.JpaRepository | ||
import java.time.LocalDate | ||
|
||
interface TimetableRepository : JpaRepository<Timetable, Long> { | ||
fun findBySubjectClassroomIdAndDayOrderByTime(classroomId: Long, day: LocalDate) : List<Timetable> | ||
interface TimetableRepository{ | ||
fun findByClassroomIdAndDayOrderByTime(classroomId: Long, day: LocalDate) : List<Timetable> | ||
|
||
fun insertBatch(timetables: Collection<Timetable>) | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/kotlin/com/asap/asapbackend/domain/timetable/domain/service/SubjectReader.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.asap.asapbackend.domain.timetable.domain.service | ||
|
||
import com.asap.asapbackend.domain.timetable.domain.model.Subject | ||
import com.asap.asapbackend.domain.timetable.domain.repository.SubjectRepository | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class SubjectReader( | ||
private val subjectRepository: SubjectRepository | ||
) { | ||
|
||
fun findSubjectMapByClassroomId(classroomId: Long): Map<Long, Subject> { | ||
return subjectRepository.findAllByClassroomId(classroomId).associateBy { it.id } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/com/asap/asapbackend/domain/timetable/event/TimetableCreateEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.asap.asapbackend.domain.timetable.event | ||
|
||
import com.asap.asapbackend.domain.timetable.domain.model.Subject | ||
|
||
|
||
data class MultiSubjectCreateEvent( | ||
val subjects: Set<Subject> | ||
) { | ||
} |
Oops, something went wrong.