-
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
7 changed files
with
71 additions
and
3 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 |
---|---|---|
|
@@ -2,4 +2,4 @@ spring: | |
config: | ||
import: | ||
- core.yml | ||
- persistence.yml | ||
- infrastructure.yml |
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
7 changes: 7 additions & 0 deletions
7
high-internal-api-server/src/main/kotlin/wiki/hi/hiwikiserver/persistence/GenericMapper.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,7 @@ | ||
package wiki.hi.hiwikiserver.persistence | ||
|
||
interface GenericMapper<D, E> { | ||
fun toDomain(entity: E): D | ||
|
||
fun toEntity(domain: D): E | ||
} |
19 changes: 19 additions & 0 deletions
19
...-api-server/src/main/kotlin/wiki/hi/hiwikiserver/persistence/user/entity/UserJpaEntity.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 wiki.hi.hiwikiserver.persistence.user.entity | ||
|
||
import wiki.hi.hiwikiserver.core.user.domain.Authority | ||
import wiki.hi.hiwikiserver.core.user.domain.Email | ||
import javax.persistence.* | ||
|
||
@Entity | ||
@Table(name = "USER") | ||
class UserJpaEntity ( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id", nullable = false) | ||
val id: Long?, | ||
@Embedded | ||
val email: Email, | ||
val nickName: String, | ||
val authority: Authority, | ||
val schoolId: Long | ||
) |
23 changes: 23 additions & 0 deletions
23
...nal-api-server/src/main/kotlin/wiki/hi/hiwikiserver/persistence/user/mapper/UserMapper.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,23 @@ | ||
package wiki.hi.hiwikiserver.persistence.user.mapper | ||
|
||
import wiki.hi.hiwikiserver.core.user.domain.User | ||
import wiki.hi.hiwikiserver.persistence.GenericMapper | ||
import wiki.hi.hiwikiserver.persistence.user.entity.UserJpaEntity | ||
|
||
class UserMapper : GenericMapper<User, UserJpaEntity> { | ||
override fun toDomain(entity: UserJpaEntity): User { | ||
TODO("ThumbsUpsId과 contributeId 때문에 추후에 개발") | ||
} | ||
|
||
override fun toEntity(domain: User): UserJpaEntity { | ||
|
||
return UserJpaEntity( | ||
id = domain.id, | ||
email = domain.email, | ||
nickName = domain.nickName, | ||
authority = domain.authority, | ||
schoolId = domain.schoolId | ||
) | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
high-internal-api-server/src/main/resources/infrastructure.yml
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,20 @@ | ||
spring: | ||
datasource: | ||
driver-class-name: com.mysql.cj.jdbc.Driver | ||
url: ${DB_URL} | ||
username: ${DB_USERNAME} | ||
password: ${DB_PASSWORD} | ||
|
||
logging: | ||
level: | ||
org: | ||
hibernate: | ||
SQL: debug | ||
|
||
jpa: | ||
database: mysql | ||
|
||
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect | ||
generate-ddl: true | ||
hibernate: | ||
ddl-auto: update |
This file was deleted.
Oops, something went wrong.