-
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.
refact: update domain structures for refactoring
- `AuditingEntityListener` 추가 - 기존: 리스트 순차 탐색 ➡️ Map의 key값으로 탐색 개선 - 패키지명 `enums` ➡️ `enum` 으로 변경
- Loading branch information
Showing
16 changed files
with
124 additions
and
87 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
58 changes: 58 additions & 0 deletions
58
src/main/kotlin/com/dobby/backend/infrastructure/database/entity/Participant.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,58 @@ | ||
package com.dobby.backend.infrastructure.database.entity | ||
|
||
import com.dobby.backend.infrastructure.database.entity.enum.GenderType | ||
import com.dobby.backend.infrastructure.database.entity.enum.MatchType | ||
import com.dobby.backend.infrastructure.database.entity.enum.ProviderType | ||
import com.dobby.backend.infrastructure.database.entity.enum.RoleType | ||
import com.dobby.backend.infrastructure.database.entity.enum.areaInfo.Area | ||
import com.dobby.backend.infrastructure.database.entity.enum.areaInfo.Region | ||
import jakarta.persistence.Column | ||
import jakarta.persistence.DiscriminatorValue | ||
import jakarta.persistence.Entity | ||
import jakarta.persistence.EnumType | ||
import jakarta.persistence.Enumerated | ||
import java.time.LocalDate | ||
|
||
@Entity(name = "participant") | ||
@DiscriminatorValue("PARTICIPANT") | ||
class Participant ( | ||
@Column(name = "gender", nullable = false) | ||
@Enumerated(EnumType.STRING) | ||
val gender: GenderType, | ||
|
||
@Column(name = "basic_region", nullable = false) | ||
@Enumerated(EnumType.STRING) | ||
var basicRegion: Region, | ||
|
||
@Column(name = "basic_area", nullable = false) | ||
@Enumerated(EnumType.STRING) | ||
var basicArea : Area, | ||
|
||
@Column(name = "optional_region", nullable = true) | ||
@Enumerated(EnumType.STRING) | ||
var optionalRegion: Region, | ||
|
||
@Column(name = "optional_area", nullable = true) | ||
@Enumerated(EnumType.STRING) | ||
var optionalArea: Area, | ||
|
||
@Column(name = "prefer_type", nullable = true) | ||
@Enumerated(EnumType.STRING) | ||
var preferType: MatchType, | ||
|
||
id: Long, | ||
oauthEmail: String, | ||
provider: ProviderType, | ||
contactEmail: String, | ||
name: String, | ||
birthDate: LocalDate | ||
) : Member( | ||
id= id, | ||
oauthEmail = oauthEmail, | ||
provider = provider, | ||
contactEmail= contactEmail, | ||
role = RoleType.PARTICIPANT, | ||
name = name, | ||
birthDate = birthDate | ||
) | ||
|
46 changes: 0 additions & 46 deletions
46
src/main/kotlin/com/dobby/backend/infrastructure/database/entity/ParticipantEntity.kt
This file was deleted.
Oops, something went wrong.
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: 6 additions & 0 deletions
6
src/main/kotlin/com/dobby/backend/infrastructure/database/entity/common/AuditingEntity.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,15 +1,21 @@ | ||
package com.dobby.backend.infrastructure.database.entity.common | ||
|
||
import jakarta.persistence.Column | ||
import jakarta.persistence.EntityListeners | ||
import jakarta.persistence.MappedSuperclass | ||
import org.springframework.data.annotation.CreatedDate | ||
import org.springframework.data.annotation.LastModifiedDate | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener | ||
import java.time.LocalDateTime | ||
|
||
@MappedSuperclass | ||
@EntityListeners(AuditingEntityListener::class) | ||
abstract class AuditingEntity { | ||
@CreatedDate | ||
@Column(name = "created_at", nullable = false, updatable = false) | ||
var createdAt: LocalDateTime? = null | ||
|
||
@LastModifiedDate | ||
@Column(name = "updated_at", nullable = false) | ||
var updatedAt: LocalDateTime? = null | ||
} |
5 changes: 5 additions & 0 deletions
5
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.dobby.backend.infrastructure.database.entity.enum | ||
|
||
enum class GenderType { | ||
MALE, FEMALE, SECRET | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/kotlin/com/dobby/backend/infrastructure/database/entity/enum/MatchType.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,5 @@ | ||
package com.dobby.backend.infrastructure.database.entity.enum | ||
|
||
enum class MatchType { | ||
OFFLINE, ONLINE, HYBRID | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/kotlin/com/dobby/backend/infrastructure/database/entity/enum/MemberStatus.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,6 @@ | ||
package com.dobby.backend.infrastructure.database.entity.enum | ||
|
||
enum class MemberStatus { | ||
HOLD, | ||
ACTIVE | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/kotlin/com/dobby/backend/infrastructure/database/entity/enum/ProviderType.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,5 @@ | ||
package com.dobby.backend.infrastructure.database.entity.enum | ||
|
||
enum class ProviderType { | ||
NAVER, GOOGLE | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/kotlin/com/dobby/backend/infrastructure/database/entity/enum/RoleType.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,5 @@ | ||
package com.dobby.backend.infrastructure.database.entity.enum | ||
|
||
enum class RoleType { | ||
RESEARCHER, PARTICIPANT | ||
} |
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
5 changes: 0 additions & 5 deletions
5
src/main/kotlin/com/dobby/backend/infrastructure/database/entity/enums/GenderType.kt
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
src/main/kotlin/com/dobby/backend/infrastructure/database/entity/enums/MatchType.kt
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
src/main/kotlin/com/dobby/backend/infrastructure/database/entity/enums/ProviderType.kt
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
src/main/kotlin/com/dobby/backend/infrastructure/database/entity/enums/RoleType.kt
This file was deleted.
Oops, something went wrong.