Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/user #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion high-api-server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ spring:
config:
import:
- core.yml
- persistence.yml
- infrastructure.yml
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package wiki.hi.hiwikiserver.core.user.domain

enum class Authority {
USER, MANAGER, ADMIN
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package wiki.hi.hiwikiserver.core.user.domain

class Email(
email: String
) {
companion object {
fun of(email: String): Email{
if (email.endsWith("hs.kr"))
return Email(email)

else
throw IllegalArgumentException("email의 형식이 올바르지 않습니다.")
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package wiki.hi.hiwikiserver.core.user.domain

data class User (
val id: Long,
val email: Email,
val nickName: String,
val authority: Authority,
val schoolId: Long,
val contributeId: ArrayList<Long>,
val thumbsUpsId: ArrayList<Long>
)
Empty file.
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
}
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
)
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 high-internal-api-server/src/main/resources/infrastructure.yml
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.