Skip to content

Commit

Permalink
refactor: survey.domain 패키지를 me.nalab.api.survey.domain 으로 변경한다
Browse files Browse the repository at this point in the history
  • Loading branch information
devxb committed Mar 9, 2024
1 parent 23837a8 commit a72fa11
Show file tree
Hide file tree
Showing 22 changed files with 48 additions and 49 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package domain.feedback
package me.nalab.api.survey.domain.feedback

import me.nalab.core.time.TimeUtil
import java.time.Instant
Expand All @@ -8,7 +8,7 @@ import javax.persistence.Embeddable
@Embeddable
class Bookmark(
@Column(name = "is_bookmarked", nullable = false)
var isBookmarked: Boolean = domain.feedback.Bookmark.Companion.BOOKMARK_DEFAULT_STATE,
var isBookmarked: Boolean = BOOKMARK_DEFAULT_STATE,

@Column(name = "bookmarked_at", columnDefinition = "TIMESTAMP(6)", nullable = false)
var bookmarkedAt: Instant,
Expand All @@ -17,7 +17,6 @@ class Bookmark(
companion object {
private const val BOOKMARK_DEFAULT_STATE = false

fun impossible(): domain.feedback.Bookmark =
domain.feedback.Bookmark(bookmarkedAt = TimeUtil.toInstant())
fun impossible(): Bookmark = Bookmark(bookmarkedAt = TimeUtil.toInstant())
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package domain.feedback
package me.nalab.api.survey.domain.feedback

import javax.persistence.*

Expand All @@ -7,11 +7,11 @@ class ChoiceFormQuestionFeedback(
id: Long,
formQuestionId: Long,
isRead: Boolean = false,
bookmark: domain.feedback.Bookmark = domain.feedback.Bookmark.Companion.impossible(),
feedback: domain.feedback.Feedback,
bookmark: Bookmark = Bookmark.impossible(),
feedback: Feedback,

@ElementCollection
@Column(name = "selects")
@CollectionTable(name = "selects", joinColumns = [JoinColumn(name = "form_feedback_id")])
private val selectedChoiceIds: MutableSet<Long>,
) : domain.feedback.FormQuestionFeedbackable(id, formQuestionId, isRead, bookmark, feedback)
) : FormQuestionFeedbackable(id, formQuestionId, isRead, bookmark, feedback)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package domain.feedback
package me.nalab.api.survey.domain.feedback

import me.nalab.core.data.common.TimeBaseEntity
import javax.persistence.*
Expand All @@ -18,17 +18,17 @@ class Feedback(
fetch = FetchType.LAZY,
cascade = [CascadeType.PERSIST, CascadeType.MERGE]
)
val questionFeedbacks: MutableList<domain.feedback.FormQuestionFeedbackable> = mutableListOf(),
val questionFeedbacks: MutableList<FormQuestionFeedbackable> = mutableListOf(),

@Column(name = "is_read", nullable = false)
private var isRead: Boolean = false,

@JoinColumn(name = "reviewer_id", nullable = false)
@OneToOne(fetch = FetchType.LAZY, cascade = [CascadeType.PERSIST, CascadeType.MERGE])
val reviewer: domain.feedback.Reviewer,
) : Comparable<domain.feedback.Feedback>, TimeBaseEntity() {
val reviewer: Reviewer,
) : Comparable<Feedback>, TimeBaseEntity() {

override fun compareTo(other: domain.feedback.Feedback): Int {
override fun compareTo(other: Feedback): Int {
if (updatedAt.isAfter(other.updatedAt)) {
return -1
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package domain.feedback
package me.nalab.api.survey.domain.feedback

import javax.persistence.*

Expand All @@ -17,9 +17,9 @@ abstract class FormQuestionFeedbackable(
open var isRead: Boolean = false,

@Embedded
open val bookmark: domain.feedback.Bookmark,
open val bookmark: Bookmark,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "feedback_id")
val feedback: domain.feedback.Feedback,
val feedback: Feedback,
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package domain.feedback
package me.nalab.api.survey.domain.feedback

import me.nalab.core.data.common.TimeBaseEntity
import domain.feedback.value.NickName
import me.nalab.api.survey.domain.feedback.value.NickName
import javax.persistence.Column
import javax.persistence.Entity
import javax.persistence.Id
Expand All @@ -15,7 +15,7 @@ class Reviewer(
val id: Long,

@Column(name = "nick_name", nullable = false)
internal var nickName: domain.feedback.value.NickName,
internal var nickName: NickName,

@Column(name = "collaboration_experience", nullable = false)
val collaborationExperience: Boolean,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package domain.feedback
package me.nalab.api.survey.domain.feedback

import javax.persistence.*

Expand All @@ -7,11 +7,11 @@ class ShortFormQuestionFeedback(
id: Long,
formQuestionId: Long,
isRead: Boolean = false,
bookmark: domain.feedback.Bookmark,
feedback: domain.feedback.Feedback,
bookmark: Bookmark,
feedback: Feedback,

@ElementCollection
@CollectionTable(name = "reply", joinColumns = [JoinColumn(name = "form_feedback_id")])
@Column(name = "replies")
val replies: MutableList<String>,
) : domain.feedback.FormQuestionFeedbackable(id, formQuestionId, isRead, bookmark, feedback)
) : FormQuestionFeedbackable(id, formQuestionId, isRead, bookmark, feedback)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package domain.feedback.value
package me.nalab.api.survey.domain.feedback.value

import javax.persistence.Embeddable

Expand All @@ -9,20 +9,20 @@ class NickName(

companion object {
private const val FIRST_NAME = "A"
fun firstNickName(): domain.feedback.value.NickName =
domain.feedback.value.NickName(domain.feedback.value.NickName.Companion.FIRST_NAME)
fun firstNickName(): NickName =
NickName(FIRST_NAME)

fun nextNickName(lastName: String): domain.feedback.value.NickName {
fun nextNickName(lastName: String): NickName {
for (i in lastName.length - 1 downTo 0) {
if (lastName[i] != 'Z') {
return domain.feedback.value.NickName(
return NickName(
lastName.substring(0, i) + (lastName[i].code + 1).toChar() + "A".repeat(
lastName.length - (i + 1)
)
)
}
}
return domain.feedback.value.NickName("A".repeat(Math.max(0, lastName.length + 1)))
return NickName("A".repeat(Math.max(0, lastName.length + 1)))
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package domain.survey
package me.nalab.api.survey.domain.survey

import javax.persistence.*

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package domain.survey
package me.nalab.api.survey.domain.survey

import me.nalab.survey.domain.survey.exception.DuplicatedOrderException
import me.nalab.api.survey.domain.survey.exception.DuplicatedOrderException
import javax.persistence.*

@Entity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package domain.survey
package me.nalab.api.survey.domain.survey

enum class ChoiceFormQuestionType {
TENDENCY,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package domain.survey
package me.nalab.api.survey.domain.survey

import me.nalab.core.data.common.TimeBaseEntity
import javax.persistence.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package domain.survey
package me.nalab.api.survey.domain.survey

enum class QuestionType {
CHOICE,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package domain.survey
package me.nalab.api.survey.domain.survey

import javax.persistence.*

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package domain.survey
package me.nalab.api.survey.domain.survey

enum class ShortFormQuestionType {
STRENGTH,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package domain.survey
package me.nalab.api.survey.domain.survey

import me.nalab.api.survey.domain.survey.exception.DuplicatedOrderException
import me.nalab.core.data.common.TimeBaseEntity
import me.nalab.survey.domain.survey.exception.DuplicatedOrderException
import javax.persistence.*

@Table(name = "survey")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package domain.survey
package me.nalab.api.survey.domain.survey

import javax.persistence.Column
import javax.persistence.Embeddable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package domain.survey
package me.nalab.api.survey.domain.survey

import org.springframework.data.jpa.repository.JpaRepository

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package domain.survey
package me.nalab.api.survey.domain.survey

import me.nalab.api.survey.domain.survey.value.ImageUrl
import me.nalab.api.survey.domain.survey.value.Job
import me.nalab.api.survey.domain.survey.value.Position
import me.nalab.core.data.common.TimeBaseEntity
import me.nalab.survey.domain.survey.value.ImageUrl
import me.nalab.survey.domain.survey.value.Job
import me.nalab.survey.domain.survey.value.Position
import javax.persistence.*

@Entity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package domain.survey.exception
package me.nalab.api.survey.domain.survey.exception

class DuplicatedOrderException internal constructor(duplicated: Int, orders: HashSet<Int>) :
RuntimeException(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package domain.survey.value
package me.nalab.api.survey.domain.survey.value

import javax.persistence.Column
import javax.persistence.Embeddable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package domain.survey.value
package me.nalab.api.survey.domain.survey.value

import javax.persistence.Column
import javax.persistence.Embeddable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package domain.survey.value
package me.nalab.api.survey.domain.survey.value

import javax.persistence.Column
import javax.persistence.Embeddable
Expand Down

0 comments on commit a72fa11

Please sign in to comment.