-
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.
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package nexters.weski.webcam | ||
|
||
import jakarta.persistence.* | ||
import nexters.weski.common.BaseEntity | ||
import nexters.weski.ski_resort.SkiResort | ||
|
||
@Entity | ||
@Table(name = "webcams") | ||
data class Webcam( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
val id: Long = 0, | ||
|
||
val name: String, | ||
val number: Int, | ||
val description: String?, | ||
val url: String, | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "resort_id") | ||
val skiResort: SkiResort | ||
) : BaseEntity() |
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,19 @@ | ||
package nexters.weski.webcam | ||
|
||
data class WebcamDto( | ||
val name: String, | ||
val number: Int, | ||
val description: String?, | ||
val url: String? | ||
) { | ||
companion object { | ||
fun fromEntity(entity: Webcam): WebcamDto { | ||
return WebcamDto( | ||
name = entity.name, | ||
number = entity.number, | ||
description = entity.description, | ||
url = entity.url | ||
) | ||
} | ||
} | ||
} |
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,7 @@ | ||
package nexters.weski.webcam | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository | ||
|
||
interface WebcamRepository : JpaRepository<Webcam, Long> { | ||
fun findAllBySkiResortResortId(resortId: Long): List<Webcam> | ||
} |