-
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.
[YS-53] feat: Experiment 관련 엔티티 추가 (#21)
* feat: add entities related to Experiment * feat: change enum's type value * style: add eof line * test: add eof line * fix: change phoneNum type from Long to String * refact: move MemberEntity to member package * test: fix failed test due to package * refact: update column's length condition * chore: add env var for email * feat: add school column * refact: rename school field to univName * refact: some fields from val to var in ExperimentPostEntity * refact: move Member Model to member package * feat: add domain model for Experiment's Entity * feat: add toDomain and fromDomain method
- Loading branch information
Showing
46 changed files
with
458 additions
and
73 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
4 changes: 2 additions & 2 deletions
4
src/main/kotlin/com/dobby/backend/application/service/EmailService.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
6 changes: 3 additions & 3 deletions
6
src/main/kotlin/com/dobby/backend/application/service/SignupService.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
2 changes: 1 addition & 1 deletion
2
src/main/kotlin/com/dobby/backend/application/usecase/GetMemberById.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
2 changes: 1 addition & 1 deletion
2
.../SignupUseCase/CreateResearcherUseCase.kt → .../signupUseCase/CreateResearcherUseCase.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
2 changes: 1 addition & 1 deletion
2
...SignupUseCase/ParticipantSignupUseCase.kt → ...signupUseCase/ParticipantSignupUseCase.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
2 changes: 1 addition & 1 deletion
2
...upUseCase/VerifyResearcherEmailUseCase.kt → ...upUseCase/VerifyResearcherEmailUseCase.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
2 changes: 1 addition & 1 deletion
2
...gnupUseCase/email/EmailCodeSendUseCase.kt → ...gnupUseCase/email/EmailCodeSendUseCase.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
2 changes: 1 addition & 1 deletion
2
...UseCase/email/EmailVerificationUseCase.kt → ...UseCase/email/EmailVerificationUseCase.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
2 changes: 1 addition & 1 deletion
2
src/main/kotlin/com/dobby/backend/domain/gateway/MemberGateway.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
2 changes: 1 addition & 1 deletion
2
src/main/kotlin/com/dobby/backend/domain/gateway/TokenGateway.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
22 changes: 22 additions & 0 deletions
22
src/main/kotlin/com/dobby/backend/domain/model/experiment/ApplyMethod.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,22 @@ | ||
package com.dobby.backend.domain.model.experiment | ||
|
||
data class ApplyMethod( | ||
val id: Long, | ||
val phoneNum: String, | ||
val formUrl: String, | ||
val content: String | ||
) { | ||
companion object { | ||
fun newApplyMethod( | ||
id: Long, | ||
phoneNum: String, | ||
formUrl: String, | ||
content: String | ||
) = ApplyMethod( | ||
id = id, | ||
phoneNum = phoneNum, | ||
formUrl = formUrl, | ||
content = content | ||
) | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/kotlin/com/dobby/backend/domain/model/experiment/ExperimentImage.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,19 @@ | ||
package com.dobby.backend.domain.model.experiment | ||
|
||
data class ExperimentImage( | ||
val id: Long, | ||
val experimentPost: ExperimentPost, | ||
val imageUrl: String | ||
) { | ||
companion object { | ||
fun newExperimentImage( | ||
id: Long, | ||
experimentPost: ExperimentPost, | ||
imageUrl: String | ||
) = ExperimentImage( | ||
id = id, | ||
experimentPost = experimentPost, | ||
imageUrl = imageUrl | ||
) | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
src/main/kotlin/com/dobby/backend/domain/model/experiment/ExperimentPost.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,76 @@ | ||
package com.dobby.backend.domain.model.experiment | ||
|
||
import com.dobby.backend.domain.model.member.Member | ||
import com.dobby.backend.infrastructure.database.entity.enum.MatchType | ||
import com.dobby.backend.infrastructure.database.entity.enum.areaInfo.Area | ||
import com.dobby.backend.infrastructure.database.entity.enum.areaInfo.Region | ||
import java.time.LocalDate | ||
|
||
data class ExperimentPost( | ||
val id: Long, | ||
val member: Member, | ||
val targetGroup: TargetGroup, | ||
val applyMethod: ApplyMethod, | ||
var views: Int, | ||
val title: String, | ||
val content: String, | ||
var researcherName: String, | ||
val reward: String, | ||
val startDate: LocalDate, | ||
val endDate: LocalDate, | ||
val durationMinutes: Int, | ||
val count: Int, | ||
val matchType: MatchType, | ||
val univName: String, | ||
val region: Region, | ||
val area: Area, | ||
val detailedAddress: String, | ||
val alarmAgree: Boolean, | ||
val images: List<ExperimentImage> | ||
) { | ||
companion object { | ||
fun newExperimentPost( | ||
id: Long, | ||
member: Member, | ||
targetGroup: TargetGroup, | ||
applyMethod: ApplyMethod, | ||
views: Int, | ||
title: String, | ||
content: String, | ||
researcherName: String, | ||
reward: String, | ||
startDate: LocalDate, | ||
endDate: LocalDate, | ||
durationMinutes: Int, | ||
count: Int, | ||
matchType: MatchType, | ||
univName: String, | ||
region: Region, | ||
area: Area, | ||
detailedAddress: String, | ||
alarmAgree: Boolean, | ||
images: List<ExperimentImage> | ||
) = ExperimentPost( | ||
id = id, | ||
member = member, | ||
targetGroup = targetGroup, | ||
applyMethod = applyMethod, | ||
views = views, | ||
title = title, | ||
content = content, | ||
researcherName = researcherName, | ||
reward = reward, | ||
startDate = startDate, | ||
endDate = endDate, | ||
durationMinutes = durationMinutes, | ||
count = count, | ||
matchType = matchType, | ||
univName = univName, | ||
region = region, | ||
area = area, | ||
detailedAddress = detailedAddress, | ||
alarmAgree = alarmAgree, | ||
images = images | ||
) | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/kotlin/com/dobby/backend/domain/model/experiment/TargetGroup.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,27 @@ | ||
package com.dobby.backend.domain.model.experiment | ||
|
||
import com.dobby.backend.infrastructure.database.entity.enum.GenderType | ||
|
||
data class TargetGroup( | ||
val id: Long, | ||
val startAge: Int, | ||
val endAge: Int, | ||
val genderType: GenderType, | ||
val otherCondition: String | ||
) { | ||
companion object { | ||
fun newTargetGroup( | ||
id: Long, | ||
startAge: Int, | ||
endAge: Int, | ||
genderType: GenderType, | ||
otherCondition: String | ||
) = TargetGroup( | ||
id = id, | ||
startAge = startAge, | ||
endAge = endAge, | ||
genderType = genderType, | ||
otherCondition = otherCondition | ||
) | ||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
.../com/dobby/backend/domain/model/Member.kt → ...bby/backend/domain/model/member/Member.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
4 changes: 2 additions & 2 deletions
4
src/main/kotlin/com/dobby/backend/infrastructure/database/entity/enum/GenderType.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,5 +1,5 @@ | ||
package com.dobby.backend.infrastructure.database.entity.enum | ||
|
||
enum class GenderType { | ||
MALE, FEMALE, SECRET | ||
} | ||
MALE, FEMALE, ALL | ||
} |
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 |
---|---|---|
|
@@ -2,4 +2,4 @@ package com.dobby.backend.infrastructure.database.entity.enum | |
|
||
enum class MatchType { | ||
OFFLINE, ONLINE, HYBRID | ||
} | ||
} |
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 |
---|---|---|
|
@@ -3,4 +3,4 @@ package com.dobby.backend.infrastructure.database.entity.enum | |
enum class MemberStatus { | ||
HOLD, | ||
ACTIVE | ||
} | ||
} |
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 |
---|---|---|
|
@@ -25,4 +25,4 @@ enum class Region(val displayName: String) { | |
return displayNameMap[name] | ||
} | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...n/kotlin/com/dobby/backend/infrastructure/database/entity/experiment/ApplyMethodEntity.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,39 @@ | ||
package com.dobby.backend.infrastructure.database.entity.experiment | ||
|
||
import com.dobby.backend.domain.model.experiment.ApplyMethod | ||
import jakarta.persistence.* | ||
|
||
@Entity(name = "apply_method") | ||
class ApplyMethodEntity ( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
val id: Long, | ||
|
||
@Column(name = "phone_num", length = 50) | ||
val phoneNum: String, | ||
|
||
@Column(name = "form_url", length = 100) | ||
val formUrl: String, | ||
|
||
@Column(name = "content", nullable = false, length = 200) | ||
val content: String, | ||
) { | ||
fun toDomain(): ApplyMethod = ApplyMethod( | ||
id = id, | ||
phoneNum = phoneNum, | ||
formUrl = formUrl, | ||
content = content | ||
) | ||
|
||
companion object { | ||
fun fromDomain(applyMethod: ApplyMethod) = with(applyMethod) { | ||
ApplyMethodEntity( | ||
id = id, | ||
phoneNum = phoneNum, | ||
formUrl = formUrl, | ||
content = content | ||
) | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...tlin/com/dobby/backend/infrastructure/database/entity/experiment/ExperimentImageEntity.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,36 @@ | ||
package com.dobby.backend.infrastructure.database.entity.experiment | ||
|
||
import AuditingEntity | ||
import com.dobby.backend.domain.model.experiment.ExperimentImage | ||
import jakarta.persistence.* | ||
|
||
@Entity(name = "experiment_image") | ||
class ExperimentImageEntity( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
val id: Long, | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "experiment_post_id", nullable = false) | ||
val experimentPost: ExperimentPostEntity, | ||
|
||
@Column(name = "image_url", nullable = false) | ||
val imageUrl: String, | ||
) : AuditingEntity() { | ||
fun toDomain(): ExperimentImage = ExperimentImage( | ||
id = id, | ||
experimentPost = experimentPost.toDomain(), | ||
imageUrl = imageUrl | ||
) | ||
|
||
companion object { | ||
fun fromDomain(experimentImage: ExperimentImage): ExperimentImageEntity = with(experimentImage) { | ||
ExperimentImageEntity( | ||
id = id, | ||
experimentPost = ExperimentPostEntity.fromDomain(experimentPost), | ||
imageUrl = imageUrl | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.