Skip to content

Commit

Permalink
Merge pull request #61 from mash-up-kr/junhyoung-add-pick-domain-table
Browse files Browse the repository at this point in the history
feat: add pick domain table
  • Loading branch information
toychip authored Aug 3, 2024
2 parents 0785663 + ee9a42c commit d1d8ae7
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.mashup.dojo.config.security

import com.mashup.dojo.service.MemberService
import org.springframework.boot.web.servlet.FilterRegistrationBean
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

Expand All @@ -10,9 +8,7 @@ class WebSecurityConfiguration {
@Bean
fun jwtTokenService() = JwtTokenService("dojo-secret-dojo-secret-dojo-secret")

/**
* 임시 제거
*/
// 임시 제거
// @Bean
// fun tokenBasedAuthenticationFilter(
// memberService: MemberService,
Expand Down
18 changes: 11 additions & 7 deletions entity/src/main/kotlin/com/mashup/dojo/PickRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,22 @@ interface PickRepository : JpaRepository<PickEntity, String> {
class PickEntity(
@Id
val id: String,
@Column(name = "questionId")
@Column(name = "question_id")
val questionId: String,
@Column(name = "pickerId")
@Column(name = "question_set_id")
val questionSetId: String,
@Column(name = "question_sheet_id")
val questionSheetId: String,
@Column(name = "picker_id")
val pickerId: String,
@Column(name = "pickedId")
@Column(name = "picked_id")
val pickedId: String,
@Column(name = "isGenderOpen")
@Column(name = "is_gender_open")
val isGenderOpen: Boolean = false,
@Column(name = "isPlatformOpen")
@Column(name = "is_platform_open")
val isPlatformOpen: Boolean = false,
@Column(name = "isMidInitialNameOpen")
@Column(name = "is_mid_initial_name_open")
val isMidInitialNameOpen: Boolean = false,
@Column(name = "isFullNameOpen")
@Column(name = "is_full_name_open")
val isFullNameOpen: Boolean = false,
) : BaseTimeEntity()
6 changes: 6 additions & 0 deletions service/src/main/kotlin/com/mashup/dojo/domain/Pick.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ value class PickId(val value: String)
data class Pick(
val id: PickId,
val questionId: QuestionId,
val questionSetId: QuestionSetId,
val questionSheetId: QuestionSheetId,
// 고른 멤버
val pickerId: MemberId,
// 골라진 멤버
Expand All @@ -29,6 +31,8 @@ data class Pick(
companion object {
internal fun create(
questionId: QuestionId,
questionSetId: QuestionSetId,
questionSheetId: QuestionSheetId,
pickerId: MemberId,
pickedId: MemberId,
): Pick {
Expand All @@ -37,6 +41,8 @@ data class Pick(
return Pick(
id = PickId(uuid),
questionId = questionId,
questionSetId = questionSetId,
questionSheetId = questionSheetId,
pickerId = pickerId,
pickedId = pickedId,
createdAt = LocalDateTime.now(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.mashup.dojo.domain.PickOpenItem
import com.mashup.dojo.domain.PickSort
import com.mashup.dojo.domain.QuestionId
import com.mashup.dojo.domain.QuestionSetId
import com.mashup.dojo.domain.QuestionSheetId
import org.springframework.data.domain.Page
import org.springframework.data.domain.PageImpl
import org.springframework.data.domain.PageRequest
Expand All @@ -34,6 +35,8 @@ interface PickService {

fun create(
questionId: QuestionId,
questionSetId: QuestionSetId,
questionSheetId: QuestionSheetId,
pickerMemberId: MemberId,
pickedMemberId: MemberId,
): PickId
Expand Down Expand Up @@ -85,12 +88,16 @@ class DefaultPickService(
@Transactional
override fun create(
questionId: QuestionId,
questionSetId: QuestionSetId,
questionSheetId: QuestionSheetId,
pickerMemberId: MemberId,
pickedMemberId: MemberId,
): PickId {
val pick =
Pick.create(
questionId = questionId,
questionSetId = questionSetId,
questionSheetId = questionSheetId,
pickerId = pickerMemberId,
pickedId = pickedMemberId
)
Expand Down Expand Up @@ -154,6 +161,8 @@ class DefaultPickService(
Pick(
id = PickId("pickmepickme"),
questionId = QuestionId("question"),
questionSetId = QuestionSetId("questionSetId"),
questionSheetId = QuestionSheetId("questionSheetId"),
pickerId = MemberId("뽑은놈"),
pickedId = MemberId("뽑힌놈"),
isGenderOpen = false,
Expand Down Expand Up @@ -185,6 +194,8 @@ class DefaultPickService(
Pick(
id = PickId("SAMPLE_PICK_ID"),
questionId = QuestionId("SAMPLE_QUESTION_ID"),
questionSetId = QuestionSetId("questionSetId"),
questionSheetId = QuestionSheetId("questionSheetId"),
pickerId = MemberId("SAMPLE_MEMBER_ID"),
pickedId = MemberId("SAMPLE_MEMBER_ID"),
isGenderOpen = true,
Expand All @@ -201,6 +212,8 @@ private fun Pick.toEntity(): PickEntity {
return PickEntity(
id = id.value,
questionId = questionId.value,
questionSetId = questionSetId.value,
questionSheetId = questionSheetId.value,
pickerId = pickerId.value,
pickedId = pickedId.value,
isGenderOpen = isGenderOpen,
Expand All @@ -214,6 +227,8 @@ private fun PickEntity.toPick(): Pick {
return Pick(
id = PickId(id),
questionId = QuestionId(questionId),
questionSetId = QuestionSetId(questionSetId),
questionSheetId = QuestionSheetId(questionSheetId),
pickerId = MemberId(pickerId),
pickedId = MemberId(pickedId),
isGenderOpen = isGenderOpen,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import com.mashup.dojo.domain.PickId
import com.mashup.dojo.domain.PickOpenItem
import com.mashup.dojo.domain.PickSort
import com.mashup.dojo.domain.QuestionId
import com.mashup.dojo.domain.QuestionSetId
import com.mashup.dojo.domain.QuestionSheetId
import com.mashup.dojo.service.ImageService
import com.mashup.dojo.service.MemberService
import com.mashup.dojo.service.PickService
Expand Down Expand Up @@ -154,8 +156,15 @@ class DefaultPickUseCase(
memberService.findMemberById(command.pickedId)
?: throw DojoException.of(DojoExceptionType.NOT_EXIST, "NOT EXIST PICKED MEMBER ID ${command.pickedId}")

// ToDo
// 현재 사용자의 ID로 redis에서 questionSheetId, questionSetId를 가져옴
val questionSetId = QuestionSetId("questionSetId")
val questionSheetId = QuestionSheetId("questionSheetId")

return pickService.create(
questionId = question.id,
questionSetId = questionSetId,
questionSheetId = questionSheetId,
pickerMemberId = command.pickerId,
pickedMemberId = pickedMember.id
)
Expand Down

0 comments on commit d1d8ae7

Please sign in to comment.