diff --git a/server/src/main/kotlin/com/fone/jobOpening/domain/entity/JobOpening.kt b/server/src/main/kotlin/com/fone/jobOpening/domain/entity/JobOpening.kt index e9269451..777cf19f 100644 --- a/server/src/main/kotlin/com/fone/jobOpening/domain/entity/JobOpening.kt +++ b/server/src/main/kotlin/com/fone/jobOpening/domain/entity/JobOpening.kt @@ -97,6 +97,10 @@ data class JobOpening( recruitmentStartDate = request.secondPage.recruitmentStartDate recruitmentEndDate = request.secondPage.recruitmentEndDate representativeImageUrl = request.secondPage.representativeImageUrl + imageUrls.clear() + request.secondPage.imageUrls.forEach { + addJobOpeningImage(JobOpeningImage(it)) + } casting = request.thirdPage.casting numberOfRecruits = request.thirdPage.numberOfRecruits @@ -132,6 +136,7 @@ data class JobOpening( recruitmentStartDate = null recruitmentEndDate = null representativeImageUrl = "" + imageUrls.clear() casting = "" numberOfRecruits = -1 careers = listOf() diff --git a/server/src/main/kotlin/com/fone/jobOpening/domain/service/DeleteJobOpeningService.kt b/server/src/main/kotlin/com/fone/jobOpening/domain/service/DeleteJobOpeningService.kt index 7070f251..98625b17 100644 --- a/server/src/main/kotlin/com/fone/jobOpening/domain/service/DeleteJobOpeningService.kt +++ b/server/src/main/kotlin/com/fone/jobOpening/domain/service/DeleteJobOpeningService.kt @@ -21,12 +21,11 @@ class DeleteJobOpeningService( @Transactional suspend fun deleteJobOpening(email: String, jobOpeningId: Long) { val userId = userRepository.findByEmail(email) ?: throw NotFoundUserException() - val jobOpening = jobOpeningRepository.findByTypeAndId(null, jobOpeningId) ?: throw NotFoundJobOpeningException() + if (jobOpening.userId != userId) { throw InvalidJobOpeningUserIdException() } - jobOpening.delete() jobOpeningRepository.save(jobOpening) jobOpeningDomainRepository.deleteByJobOpeningId(jobOpeningId) diff --git a/server/src/main/kotlin/com/fone/jobOpening/presentation/dto/common/JobOpeningDto.kt b/server/src/main/kotlin/com/fone/jobOpening/presentation/dto/common/JobOpeningDto.kt index 7960c7bc..8afa48bc 100644 --- a/server/src/main/kotlin/com/fone/jobOpening/presentation/dto/common/JobOpeningDto.kt +++ b/server/src/main/kotlin/com/fone/jobOpening/presentation/dto/common/JobOpeningDto.kt @@ -48,9 +48,9 @@ data class JobOpeningDto( @Schema(description = "스크랩 여부", example = "false") val isScrap: Boolean = false, @Schema(description = "닉네임", example = "김매니저") - val nickname: String, + val userNickname: String, @Schema(description = "프로필 이미지", example = "https://www.naver.com") - val profileUrl: String, + val userProfileUrl: String, @Schema(description = "작성일", example = "2021-10-10") val createdAt: LocalDateTime, @Schema(description = "유저 직업", example = "ACTOR") @@ -124,8 +124,8 @@ data class JobOpeningDto( viewCount = jobOpening.viewCount, scrapCount = jobOpening.scrapCount, isScrap = userJobOpeningScrapMap[jobOpening.id!!] != null, - nickname = nickname, - profileUrl = profileUrl, + userNickname = nickname, + userProfileUrl = profileUrl, createdAt = jobOpening.createdAt, userJob = job, isVerified = isVerified diff --git a/server/src/main/kotlin/com/fone/profile/application/ValidateProfileFacade.kt b/server/src/main/kotlin/com/fone/profile/application/ValidateProfileFacade.kt index 14f7f963..eb263a22 100644 --- a/server/src/main/kotlin/com/fone/profile/application/ValidateProfileFacade.kt +++ b/server/src/main/kotlin/com/fone/profile/application/ValidateProfileFacade.kt @@ -9,18 +9,18 @@ class ValidateProfileFacade( private val validateProfileService: ValidateProfileService, ) { - suspend fun validateBasicPage(basicPageValidation: ValidateProfileDto.BasicPageValidation) = - validateProfileService.validateBasicPage(basicPageValidation) + suspend fun validateBasicPage(secondPage: ValidateProfileDto.SecondPage) = + validateProfileService.validateBasicPage(secondPage) - suspend fun validateDetailPage(email: String, detailPageValidation: ValidateProfileDto.DetailPageValidation) = - validateProfileService.validateDetailPage(email, detailPageValidation) + suspend fun validateDetailPage(email: String, thirdPage: ValidateProfileDto.ThirdPage) = + validateProfileService.validateDetailPage(email, thirdPage) - suspend fun validateDescriptionPage(descriptionPageValidation: ValidateProfileDto.DescriptionPageValidation) = - validateProfileService.validateDescriptionPage(descriptionPageValidation) + suspend fun validateDescriptionPage(fourthPage: ValidateProfileDto.FourthPage) = + validateProfileService.validateDescriptionPage(fourthPage) - suspend fun validateCareerPage(careerPageValidation: ValidateProfileDto.CareerPageValidation) = - validateProfileService.validateCareerPage(careerPageValidation) + suspend fun validateCareerPage(fifthPage: ValidateProfileDto.FifthPage) = + validateProfileService.validateCareerPage(fifthPage) - suspend fun validateInterestPage(interestPageValidation: ValidateProfileDto.InterestPageValidation) = - validateProfileService.validateInterestPage(interestPageValidation) + suspend fun validateInterestPage(sixthPage: ValidateProfileDto.SixthPage) = + validateProfileService.validateInterestPage(sixthPage) } diff --git a/server/src/main/kotlin/com/fone/profile/domain/entity/Profile.kt b/server/src/main/kotlin/com/fone/profile/domain/entity/Profile.kt index 39469f9c..8a6a39ae 100644 --- a/server/src/main/kotlin/com/fone/profile/domain/entity/Profile.kt +++ b/server/src/main/kotlin/com/fone/profile/domain/entity/Profile.kt @@ -2,6 +2,7 @@ package com.fone.profile.domain.entity import com.fone.common.entity.BaseEntity import com.fone.common.entity.Career +import com.fone.common.entity.ContactMethod import com.fone.common.entity.Gender import com.fone.common.entity.Type import com.fone.profile.presentation.dto.RegisterProfileDto.RegisterProfileRequest @@ -26,34 +27,48 @@ data class Profile( @Column @GeneratedValue(strategy = GenerationType.IDENTITY) var id: Long? = null, + + // page1 + @Enumerated(EnumType.STRING) var contactMethod: ContactMethod, + @Column(length = 300) var contact: String, + + // page2 @Column(length = 10) var name: String, @Column var hookingComment: String, - @Column var birthday: LocalDate?, - @Enumerated(EnumType.STRING) var gender: Gender, - @Column var height: Int, - @Column var weight: Int, + @OneToMany( + mappedBy = "profile", + cascade = [CascadeType.PERSIST, CascadeType.MERGE], + orphanRemoval = true + ) var profileImages: MutableList = mutableListOf(), + @Column var representativeImageUrl: String, + + // page3 + @Column var birthday: LocalDate, + @Enumerated(EnumType.STRING) var gender: Gender?, + @Column var height: Int?, + @Column var weight: Int?, @Column var email: String, - @Column(length = 300) var sns: String, + @Column(length = 50) var specialty: String, @OneToMany( cascade = [CascadeType.PERSIST, CascadeType.MERGE], orphanRemoval = true ) @JoinColumn(name = "profile_id") var snsUrls: Set, - @Column(length = 50) var specialty: String, + + // page4 @Column(length = 500) var details: String, + + // page5 @Enumerated(EnumType.STRING) var career: Career, @Column(length = 500) var careerDetail: String, + + // etc @Enumerated(EnumType.STRING) var type: Type, @Column var userId: Long, - @Column var viewCount: Long, + @Column var viewCount: Long = 0, + @Column var wantCount: Long = 0, @Column var isDeleted: Boolean = false, - @Column var representativeImageUrl: String, - @OneToMany( - mappedBy = "profile", - cascade = [CascadeType.PERSIST, CascadeType.MERGE], - orphanRemoval = true - ) var profileImages: MutableList = mutableListOf(), ) : BaseEntity() { fun view() { @@ -65,43 +80,54 @@ data class Profile( } fun put(request: RegisterProfileRequest) { - name = request.name - hookingComment = request.hookingComment - birthday = request.birthday - gender = request.gender - height = request.height - weight = request.weight - email = request.email - sns = request.sns ?: "" - snsUrls = request.snsUrls.map(ProfileSnsUrl::toEntity).toSet() - specialty = request.specialty - details = request.details - career = request.career - careerDetail = request.careerDetail ?: "" - type = request.type - representativeImageUrl = request.representativeImageUrl - this.profileImages = mutableListOf() - request.profileImages.forEach { - this.addProfileImage(ProfileImage(it)) + // page1 + contactMethod = request.firstPage.contactMethod + contact = request.firstPage.contact + + // page2 + name = request.secondPage.name + hookingComment = request.secondPage.hookingComment + representativeImageUrl = request.secondPage.representativeImageUrl + profileImages = mutableListOf() + request.secondPage.profileImages.forEach { + addProfileImage(ProfileImage(it)) } + + // page3 + birthday = request.thirdPage.birthday + gender = request.thirdPage.gender + height = request.thirdPage.height + weight = request.thirdPage.weight + email = request.thirdPage.email + specialty = request.thirdPage.specialty + snsUrls = request.thirdPage.snsUrls.map(ProfileSnsUrl::toEntity).toSet() + + // page4 + details = request.fourthPage.details + + // page5 + career = request.fifthPage.career + careerDetail = request.fifthPage.careerDetail + + // page6 + type = request.type } fun delete() { + contact = "" + name = "" hookingComment = "" - birthday = null - gender = Gender.IRRELEVANT - height = 0 - weight = 0 + representativeImageUrl = "" + profileImages = mutableListOf() + gender = null + height = null + weight = null email = "" - sns = "" - snsUrls = emptySet() specialty = "" + snsUrls = setOf() details = "" - career = Career.IRRELEVANT careerDetail = "" - type = Type.ACTOR isDeleted = true - this.profileImages = mutableListOf() } /* 연관관계 메서드 */ diff --git a/server/src/main/kotlin/com/fone/profile/domain/service/DeleteProfileService.kt b/server/src/main/kotlin/com/fone/profile/domain/service/DeleteProfileService.kt index 36782333..2ddb9c6b 100644 --- a/server/src/main/kotlin/com/fone/profile/domain/service/DeleteProfileService.kt +++ b/server/src/main/kotlin/com/fone/profile/domain/service/DeleteProfileService.kt @@ -8,6 +8,7 @@ import com.fone.profile.domain.repository.ProfileCategoryRepository import com.fone.profile.domain.repository.ProfileDomainRepository import com.fone.profile.domain.repository.ProfileRepository import org.springframework.stereotype.Service +import javax.transaction.Transactional @Service class DeleteProfileService( @@ -17,6 +18,7 @@ class DeleteProfileService( private val userRepository: UserCommonRepository, ) { + @Transactional suspend fun deleteProfile(email: String, profileId: Long) { val userId = userRepository.findByEmail(email) ?: throw NotFoundUserException() val profile = profileRepository.findByTypeAndId(null, profileId) ?: throw NotFoundProfileException() diff --git a/server/src/main/kotlin/com/fone/profile/domain/service/PutProfileService.kt b/server/src/main/kotlin/com/fone/profile/domain/service/PutProfileService.kt index 910d473a..1ce0f8da 100644 --- a/server/src/main/kotlin/com/fone/profile/domain/service/PutProfileService.kt +++ b/server/src/main/kotlin/com/fone/profile/domain/service/PutProfileService.kt @@ -42,7 +42,7 @@ class PutProfileService( val userProfileWants = profileWantRepository.findByUserId(user.id!!) profileDomainRepository.deleteByProfileId(profile.id!!) - val profileDomains = request.domains?.map { + val profileDomains = request.thirdPage.domains?.map { ProfileDomain( profile.id!!, it @@ -51,7 +51,7 @@ class PutProfileService( profileDomainRepository.saveAll(profileDomains) profileCategoryRepository.deleteByProfileId(profile.id!!) - val profileCategories = request.categories.map { + val profileCategories = request.sixthPage.categories.map { ProfileCategory( profile.id!!, it @@ -64,8 +64,8 @@ class PutProfileService( return RegisterProfileResponse( profile, userProfileWants, - request.domains, - request.categories, + request.thirdPage.domains, + request.sixthPage.categories, profileUser?.nickname ?: "", profileUser?.profileUrl ?: "", profileUser?.job ?: Job.ACTOR diff --git a/server/src/main/kotlin/com/fone/profile/domain/service/RegisterProfileService.kt b/server/src/main/kotlin/com/fone/profile/domain/service/RegisterProfileService.kt index fcd9e7b2..33c4f4f9 100644 --- a/server/src/main/kotlin/com/fone/profile/domain/service/RegisterProfileService.kt +++ b/server/src/main/kotlin/com/fone/profile/domain/service/RegisterProfileService.kt @@ -32,7 +32,7 @@ class RegisterProfileService( val user = userRepository.findByEmail(email) ?: throw NotFoundUserException() return with(request) { val profile = toEntity(user.id!!) - profileImages.forEach { + secondPage.profileImages.forEach { profile.addProfileImage( ProfileImage( it @@ -42,14 +42,14 @@ class RegisterProfileService( profileRepository.save(profile) - val profileDomains = domains?.map { + val profileDomains = thirdPage.domains?.map { ProfileDomain( profile.id!!, it ) } - val profileCategories = categories.map { + val profileCategories = sixthPage.categories.map { ProfileCategory( profile.id!!, it @@ -66,8 +66,8 @@ class RegisterProfileService( RegisterProfileResponse( profile, userProfileWants, - domains, - categories, + thirdPage.domains, + sixthPage.categories, profileUser?.nickname ?: "", profileUser?.profileUrl ?: "", profileUser?.job ?: Job.ACTOR diff --git a/server/src/main/kotlin/com/fone/profile/domain/service/ValidateProfileService.kt b/server/src/main/kotlin/com/fone/profile/domain/service/ValidateProfileService.kt index 2ccfc256..87ebeda1 100644 --- a/server/src/main/kotlin/com/fone/profile/domain/service/ValidateProfileService.kt +++ b/server/src/main/kotlin/com/fone/profile/domain/service/ValidateProfileService.kt @@ -14,7 +14,7 @@ class ValidateProfileService( private val urlValidator = URLValidator() private val emailRegex = Regex("^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+$") - fun validateBasicPage(request: ValidateProfileDto.BasicPageValidation) { + fun validateBasicPage(request: ValidateProfileDto.SecondPage) { if (request.name.isBlank()) { throw RequestValidationException("본인의 이름을 입력해 주세요.") } @@ -31,7 +31,7 @@ class ValidateProfileService( suspend fun validateDetailPage( email: String, - request: ValidateProfileDto.DetailPageValidation, + request: ValidateProfileDto.ThirdPage, ) { if (LocalDate.now().year - request.birthday.year > 100) { throw RequestValidationException("100세 이상의 나이는 입력할 수 없습니다.") @@ -68,18 +68,18 @@ class ValidateProfileService( } } - fun validateDescriptionPage(descriptionPageValidation: ValidateProfileDto.DescriptionPageValidation) { - if (descriptionPageValidation.details.length < 8) { + fun validateDescriptionPage(fourthPage: ValidateProfileDto.FourthPage) { + if (fourthPage.details.length < 8) { throw RequestValidationException("최소 8자 이상의 상세 요강을 입력해주세요.") } } - fun validateCareerPage(careerPageValidation: ValidateProfileDto.CareerPageValidation) { + fun validateCareerPage(fifthPage: ValidateProfileDto.FifthPage) { // 검증 할 것 없음 return } - fun validateInterestPage(interestPageValidation: ValidateProfileDto.InterestPageValidation) { + fun validateInterestPage(sixthPage: ValidateProfileDto.SixthPage) { // 검증 할 것 없음 return } diff --git a/server/src/main/kotlin/com/fone/profile/domain/service/WantProfileService.kt b/server/src/main/kotlin/com/fone/profile/domain/service/WantProfileService.kt index 23fa707d..5ae6372c 100644 --- a/server/src/main/kotlin/com/fone/profile/domain/service/WantProfileService.kt +++ b/server/src/main/kotlin/com/fone/profile/domain/service/WantProfileService.kt @@ -20,11 +20,20 @@ class WantProfileService( profileWantRepository.findByUserIdAndProfileId(userId, profileId)?.let { profileWantRepository.delete(it) + + val profile = profileRepository.findByTypeAndId(null, profileId) ?: throw NotFoundProfileException() + + profile.wantCount -= 1 + + profileRepository.save(profile) return } - profileRepository.findByTypeAndId(null, profileId) ?: throw NotFoundProfileException() + val profile = profileRepository.findByTypeAndId(null, profileId) ?: throw NotFoundProfileException() + + profile.wantCount += 1 profileWantRepository.save(ProfileWant(userId, profileId)) + profileRepository.save(profile) } } diff --git a/server/src/main/kotlin/com/fone/profile/presentation/controller/ValidateProfileController.kt b/server/src/main/kotlin/com/fone/profile/presentation/controller/ValidateProfileController.kt index 14c74a35..b57871ce 100644 --- a/server/src/main/kotlin/com/fone/profile/presentation/controller/ValidateProfileController.kt +++ b/server/src/main/kotlin/com/fone/profile/presentation/controller/ValidateProfileController.kt @@ -46,9 +46,9 @@ class ValidateProfileController( ) suspend fun basicPageValidate( @RequestBody - basicPageValidation: ValidateProfileDto.BasicPageValidation, + secondPage: ValidateProfileDto.SecondPage, ): CommonResponse { - validateProfileFacade.validateBasicPage(basicPageValidation) + validateProfileFacade.validateBasicPage(secondPage) return CommonResponse.success() } @@ -62,9 +62,9 @@ class ValidateProfileController( suspend fun detailPageValidate( principal: Principal, @RequestBody - detailPageValidation: ValidateProfileDto.DetailPageValidation, + thirdPage: ValidateProfileDto.ThirdPage, ): CommonResponse { - validateProfileFacade.validateDetailPage(principal.name, detailPageValidation) + validateProfileFacade.validateDetailPage(principal.name, thirdPage) return CommonResponse.success() } @@ -77,9 +77,9 @@ class ValidateProfileController( ) suspend fun descriptionValidate( @RequestBody - descriptionPageValidation: ValidateProfileDto.DescriptionPageValidation, + fourthPage: ValidateProfileDto.FourthPage, ): CommonResponse { - validateProfileFacade.validateDescriptionPage(descriptionPageValidation) + validateProfileFacade.validateDescriptionPage(fourthPage) return CommonResponse.success() } @@ -92,9 +92,9 @@ class ValidateProfileController( ) suspend fun careerValidate( @RequestBody - careerPageValidation: ValidateProfileDto.CareerPageValidation, + fifthPage: ValidateProfileDto.FifthPage, ): CommonResponse { - validateProfileFacade.validateCareerPage(careerPageValidation) + validateProfileFacade.validateCareerPage(fifthPage) return CommonResponse.success() } @@ -107,9 +107,9 @@ class ValidateProfileController( ) suspend fun interestValidate( @RequestBody - interestPageValidation: ValidateProfileDto.InterestPageValidation, + sixthPage: ValidateProfileDto.SixthPage, ): CommonResponse { - validateProfileFacade.validateInterestPage(interestPageValidation) + validateProfileFacade.validateInterestPage(sixthPage) return CommonResponse.success() } } diff --git a/server/src/main/kotlin/com/fone/profile/presentation/dto/RegisterProfileDto.kt b/server/src/main/kotlin/com/fone/profile/presentation/dto/RegisterProfileDto.kt index 0d7310f9..0b6e88f7 100644 --- a/server/src/main/kotlin/com/fone/profile/presentation/dto/RegisterProfileDto.kt +++ b/server/src/main/kotlin/com/fone/profile/presentation/dto/RegisterProfileDto.kt @@ -1,90 +1,58 @@ package com.fone.profile.presentation.dto -import com.fone.common.entity.Career import com.fone.common.entity.CategoryType import com.fone.common.entity.DomainType -import com.fone.common.entity.Gender import com.fone.common.entity.Type +import com.fone.jobOpening.presentation.dto.ValidateJobOpeningDto import com.fone.profile.domain.entity.Profile import com.fone.profile.domain.entity.ProfileWant import com.fone.profile.presentation.dto.common.ProfileDto import com.fone.profile.presentation.dto.common.ProfileSnsUrl import com.fone.user.domain.enum.Job import io.swagger.v3.oas.annotations.media.Schema -import org.springframework.format.annotation.DateTimeFormat -import java.time.LocalDate -import javax.validation.constraints.Email class RegisterProfileDto { data class RegisterProfileRequest( - @field:Schema(description = "프로필 이름", required = true, example = "차이나는 클라스") - val name: String, - @field:Schema(description = "후킹멘트", required = true, example = "제가 좋아하는 색은 노랑색이에요") - val hookingComment: String, - @field:Schema(description = "생년월일", required = true, example = "2000-10-01") - @DateTimeFormat(pattern = "yyyy-MM-dd") - val birthday: LocalDate, - @field:Schema(description = "성별", example = "WOMAN", required = true) - val gender: Gender, - @field:Schema(description = "키", example = "188", required = true) - val height: Int, - @field:Schema(description = "몸무게", example = "70", required = true) - val weight: Int, - @field:Email(message = "유효하지 않는 이메일 입니다.") - @field:Schema( - description = "이메일", - example = "test@test.com", - required = true - ) - val email: String, - @field:Schema(description = "SNS url v1", example = "https://www.youtube.com/channel") - val sns: String? = null, - @field:Schema(description = "SNS url v2") - val snsUrls: List = listOf(), - @field:Schema(description = "특기", required = true, example = "매운 음식 먹기") - val specialty: String, - @field:Schema(description = "상세요강", required = true) - val details: String, - @field:Schema(description = "경력", required = true, example = "LESS_THAN_10YEARS") - val career: Career, - @field:Schema(description = "경력 상세 설명", example = "복숭아 요거트 제작 3년") - val careerDetail: String?, // 하위 버전 호환성을 위해 null타입 추가 필요 - @field:Schema(description = "관심사", example = "[\"YOUTUBE\"]", required = true) - val categories: List, + @Schema(description = "1번째 페이지") + val firstPage: ValidateJobOpeningDto.FirstPage, + + @Schema(description = "2번째 페이지") + val secondPage: ValidateProfileDto.SecondPage, + + @Schema(description = "3번째 페이지") + val thirdPage: ValidateProfileDto.ThirdPage, + + @Schema(description = "4번째 페이지") + val fourthPage: ValidateProfileDto.FourthPage, + + @Schema(description = "5번째 페이지") + val fifthPage: ValidateProfileDto.FifthPage, + + @Schema(description = "6번째 페이지") + val sixthPage: ValidateProfileDto.SixthPage, + @field:Schema(description = "타입", required = true) val type: Type, - @field:Schema(description = "분야", example = "[\"PLANNING\"]") - val domains: List?, - @field:Schema( - description = "이미지 URL", - example = "['https://s3-ap-northeast-2.amazonaws.com/f-one-image/prod/user-profile/image.jpg']" - ) - val profileImages: List, - @field:Schema( - description = "대표 이미지 URL", - example = "https://s3-ap-northeast-2.amazonaws.com/f-one-image/prod/user-profile/image.jpg" - ) - val representativeImageUrl: String, ) { fun toEntity(userId: Long): Profile { return Profile( - hookingComment = hookingComment, - birthday = birthday, - gender = gender, - height = height, - weight = weight, - email = email, - sns = sns ?: "", - snsUrls = snsUrls.map(ProfileSnsUrl::toEntity).toSet(), - specialty = specialty, - details = details, - career = career, - careerDetail = careerDetail ?: "", + contactMethod = firstPage.contactMethod, + contact = firstPage.contact, + name = secondPage.name, + hookingComment = secondPage.hookingComment, + representativeImageUrl = secondPage.representativeImageUrl, + birthday = thirdPage.birthday, + gender = thirdPage.gender, + height = thirdPage.height, + weight = thirdPage.weight, + email = thirdPage.email, + specialty = thirdPage.specialty, + snsUrls = thirdPage.snsUrls.map(ProfileSnsUrl::toEntity).toSet(), + details = fourthPage.details, + career = fifthPage.career, + careerDetail = fifthPage.careerDetail, type = type, - userId = userId, - viewCount = 0, - name = name, - representativeImageUrl = representativeImageUrl + userId = userId ) } } diff --git a/server/src/main/kotlin/com/fone/profile/presentation/dto/ValidateProfileDto.kt b/server/src/main/kotlin/com/fone/profile/presentation/dto/ValidateProfileDto.kt index 8a673710..0821215a 100644 --- a/server/src/main/kotlin/com/fone/profile/presentation/dto/ValidateProfileDto.kt +++ b/server/src/main/kotlin/com/fone/profile/presentation/dto/ValidateProfileDto.kt @@ -5,58 +5,102 @@ import com.fone.common.entity.CategoryType import com.fone.common.entity.DomainType import com.fone.common.entity.Gender import com.fone.profile.presentation.dto.common.ProfileSnsUrl +import io.swagger.annotations.ApiModelProperty import io.swagger.v3.oas.annotations.media.Schema +import org.springframework.format.annotation.DateTimeFormat import java.time.LocalDate class ValidateProfileDto { - data class BasicPageValidation( + data class SecondPage( @Schema(description = "프로필 이름", required = true, example = "차이나는 클라스") + @ApiModelProperty(value = "프로필 이름", required = true, example = "차이나는 클라스") val name: String, + @Schema(description = "후킹멘트", required = true, example = "제가 좋아하는 색은 노랑색이에요") + @ApiModelProperty(value = "후킹멘트", required = true, example = "제가 좋아하는 색은 노랑색이에요") val hookingComment: String, + @Schema( description = "이미지 URL", example = "['https://s3-ap-northeast-2.amazonaws.com/f-one-image/prod/user-profile/image.jpg']" ) + @ApiModelProperty( + value = "이미지 URL", + example = "['https://s3-ap-northeast-2.amazonaws.com/f-one-image/prod/user-profile/image.jpg']" + ) val profileImages: List, + + @Schema( + description = "대표 이미지 URL", + example = "https://s3-ap-northeast-2.amazonaws.com/f-one-image/prod/user-profile/image.jpg" + ) + @ApiModelProperty( + value = "대표 이미지 URL", + example = "https://s3-ap-northeast-2.amazonaws.com/f-one-image/prod/user-profile/image.jpg" + ) + val representativeImageUrl: String, ) - data class DetailPageValidation( - @Schema(description = "생년월일", example = "2000.10.01") + data class ThirdPage( + @Schema(description = "생년월일", example = "2000-10-01") + @ApiModelProperty(value = "생년월일", example = "2000-10-01") + @DateTimeFormat(pattern = "yyyy-MM-dd") val birthday: LocalDate, + @Schema(description = "성별 (enum값에 성별무관 있음)", example = "WOMAN") + @ApiModelProperty(value = "성별 (enum값에 성별무관 있음)", example = "WOMAN") val gender: Gender?, + @Schema(description = "키 (스태프에서는 null, 유저 입력안할 시 -값으로 설정)", example = "188") + @ApiModelProperty(value = "키 (스태프에서는 null, 유저 입력안할 시 -값으로 설정)", example = "188") val height: Int?, + @Schema(description = "몸무게 (스태프에서는 null, 유저 입력안할 시 -값으로 설정)", example = "70") + @ApiModelProperty(value = "몸무게 (스태프에서는 null, 유저 입력안할 시 -값으로 설정)", example = "70") val weight: Int?, + @Schema(description = "이메일", example = "example@something.com") + @ApiModelProperty(value = "이메일", example = "example@something.com") val email: String, + @Schema(description = "분야 (배우에서는 null)", example = "[\"PLANNING\",\"SCENARIO\"]") + @ApiModelProperty(value = "분야 (배우에서는 null)", example = "[\"PLANNING\",\"SCENARIO\"]") val domains: List?, + @Schema(description = "특기", example = "매운 음식 먹기") + @ApiModelProperty(value = "특기", example = "매운 음식 먹기") val specialty: String, + @Schema( description = "SNS link", - example = "[{\"snsType\":\"INSTAGRAM\",\"url\":\"https://www.instagram.com/\"}]" + example = "[{\"sns\":\"INSTAGRAM\",\"url\":\"https://www.instagram.com/\"}]" + ) + @ApiModelProperty( + value = "SNS link", + example = "[{\"sns\":\"INSTAGRAM\",\"url\":\"https://www.instagram.com/\"}]" ) val snsUrls: List, ) - data class DescriptionPageValidation( - @Schema(description = "상세요강") + data class FourthPage( + @Schema(description = "상세요강", example = "상세요강") + @ApiModelProperty(value = "상세요강", example = "상세요강") val details: String, ) - data class CareerPageValidation( + data class FifthPage( @Schema(description = "경력", example = "LESS_THAN_3YEARS") + @ApiModelProperty(value = "경력", example = "LESS_THAN_3YEARS") val career: Career, + @Schema(description = "경력 상세 설명", example = "복숭아 요거트 제작 3년") + @ApiModelProperty(value = "경력 상세 설명", example = "복숭아 요거트 제작 3년") val careerDetail: String, ) - data class InterestPageValidation( - @Schema(description = "관심사", example = "WEB_DRAMA") + data class SixthPage( + @Schema(description = "관심사", example = "[\"WEB_DRAMA\"]") + @ApiModelProperty(value = "관심사", example = "[\"WEB_DRAMA\"]") val categories: List, ) } diff --git a/server/src/main/kotlin/com/fone/profile/presentation/dto/common/ProfileDto.kt b/server/src/main/kotlin/com/fone/profile/presentation/dto/common/ProfileDto.kt index 90b3de82..8b0753ab 100644 --- a/server/src/main/kotlin/com/fone/profile/presentation/dto/common/ProfileDto.kt +++ b/server/src/main/kotlin/com/fone/profile/presentation/dto/common/ProfileDto.kt @@ -1,71 +1,48 @@ package com.fone.profile.presentation.dto.common -import com.fone.common.entity.Career import com.fone.common.entity.CategoryType import com.fone.common.entity.DomainType -import com.fone.common.entity.Gender import com.fone.common.entity.Type import com.fone.common.utils.DateTimeFormat +import com.fone.jobOpening.presentation.dto.ValidateJobOpeningDto import com.fone.profile.domain.entity.Profile import com.fone.profile.domain.entity.ProfileImage import com.fone.profile.domain.entity.ProfileSns import com.fone.profile.domain.entity.ProfileWant +import com.fone.profile.presentation.dto.ValidateProfileDto import com.fone.user.domain.enum.Job import io.swagger.v3.oas.annotations.media.Schema -import java.time.LocalDate import java.time.LocalDateTime data class ProfileDto( @Schema(description = "id") val id: Long, - @Schema(description = "프로필 이름", example = "차이나는 클라스") - val name: String, - @Schema(description = "후킹멘트", example = "제가 좋아하는 색은 노랑색이에요") - val hookingComment: String, - @Schema(description = "생년월일", example = "2000-10-01") - val birthday: LocalDate?, - @Schema(description = "성별", example = "WOMAN") - val gender: Gender, - @Schema(description = "키", example = "188") - val height: Int, - @Schema(description = "몸무게", example = "70") - val weight: Int, - @Schema(description = "이메일", example = "example@something.com") - val email: String, - @Schema(description = "SNS v1", example = "https://www.youtube.com/channel") - val sns: String, - @Schema(description = "SNS v2") - val snsUrls: List, - @Schema(description = "특기", example = "매운 음식 먹기") - val specialty: String, - @Schema(description = "상세요강") - val details: String, + + @Schema(description = "1번째 페이지") + val firstPage: ValidateJobOpeningDto.FirstPage, + + @Schema(description = "2번째 페이지") + val secondPage: ValidateProfileDto.SecondPage, + + @Schema(description = "3번째 페이지") + val thirdPage: ValidateProfileDto.ThirdPage, + + @Schema(description = "4번째 페이지") + val fourthPage: ValidateProfileDto.FourthPage, + + @Schema(description = "5번째 페이지") + val fifthPage: ValidateProfileDto.FifthPage, + + @Schema(description = "6번째 페이지") + val sixthPage: ValidateProfileDto.SixthPage, + @Schema(description = "타입") val type: Type, - @Schema(description = "경력", example = "LESS_THAN_3YEARS") - val career: Career, - @Schema(description = "경력 상세 설명", example = "복숭아 요거트 제작 3년") - val careerDetail: String, - @Schema(description = "관심사", example = "WEB_DRAMA") - val categories: List, - @Schema(description = "분야", example = "PLANNING") - val domains: List?, - @Schema( - description = "이미지 URL", - example = "['https://s3-ap-northeast-2.amazonaws.com/f-one-image/prod/user-profile/image.jpg']" - ) - val profileImages: List, + @Schema(description = "조회수") val viewCount: Long, - @Schema( - description = "대표 이미지 URL", - example = "https://s3-ap-northeast-2.amazonaws.com/f-one-image/prod/user-profile/image.jpg" - ) - val representativeImageUrl: String, @Schema(description = "찜 여부") val isWant: Boolean = false, - @Schema(description = "나이", example = "45") - val age: Int, @Schema(description = "생성 시간") val createdAt: LocalDateTime, @Schema(description = "닉네임") @@ -78,6 +55,10 @@ data class ProfileDto( @Schema(description = "Job 타입") val userJob: Job, ) { + @get:Schema(description = "나이", example = "45") + val age: Int + get() = DateTimeFormat.calculateAge(thirdPage.birthday) + constructor( profile: Profile, userProfileWantMap: Map, @@ -88,28 +69,40 @@ data class ProfileDto( profileUrl: String, job: Job, ) : this( - id = profile.id!!, - name = profile.name, - hookingComment = profile.hookingComment, - birthday = profile.birthday, - gender = profile.gender, - height = profile.height, - weight = profile.weight, - email = profile.email, - sns = profile.sns, - snsUrls = profile.snsUrls.map(ProfileSns::toDto), + id = profile.id ?: 0L, + firstPage = ValidateJobOpeningDto.FirstPage( + contactMethod = profile.contactMethod, + contact = profile.contact + ), + secondPage = ValidateProfileDto.SecondPage( + name = profile.name, + hookingComment = profile.hookingComment, + profileImages = profileImages.map { it.url }, + representativeImageUrl = profile.representativeImageUrl + ), + thirdPage = ValidateProfileDto.ThirdPage( + birthday = profile.birthday, + gender = profile.gender, + height = profile.height, + weight = profile.weight, + email = profile.email, + domains = domains, + specialty = profile.specialty, + snsUrls = profile.snsUrls.map(ProfileSns::toDto) + ), + fourthPage = ValidateProfileDto.FourthPage( + details = profile.details + ), + fifthPage = ValidateProfileDto.FifthPage( + career = profile.career, + careerDetail = profile.careerDetail + ), + sixthPage = ValidateProfileDto.SixthPage( + categories = categories + ), type = profile.type, - specialty = profile.specialty, - details = profile.details, - career = profile.career, - careerDetail = profile.careerDetail, - categories = categories, - domains = domains, viewCount = profile.viewCount, - isWant = userProfileWantMap[profile.id!!] != null, - age = DateTimeFormat.calculateAge(profile.birthday), - representativeImageUrl = profile.representativeImageUrl, - profileImages = profileImages.map { it.url }, + isWant = userProfileWantMap[profile.id] != null, createdAt = profile.createdAt, userNickname = userNickname, userProfileUrl = profileUrl, diff --git a/server/src/test/kotlin/com/fone/common/CommonJobOpeningCallApi.kt b/server/src/test/kotlin/com/fone/common/CommonJobOpeningCallApi.kt index 6a0ddc29..2cc0b276 100644 --- a/server/src/test/kotlin/com/fone/common/CommonJobOpeningCallApi.kt +++ b/server/src/test/kotlin/com/fone/common/CommonJobOpeningCallApi.kt @@ -67,7 +67,10 @@ object CommonJobOpeningCallApi { ) val registerJobOpeningStaffRequest = registerJobOpeningActorRequest.copy( - type = Type.STAFF + type = Type.STAFF, + thirdPage = registerJobOpeningActorRequest.thirdPage.copy( + domains = listOf(DomainType.PAINTING) + ) ) private val registerUrl = "/api/v1/job-openings" diff --git a/server/src/test/kotlin/com/fone/common/CommonProfileCallApi.kt b/server/src/test/kotlin/com/fone/common/CommonProfileCallApi.kt index 75d8d350..396a5d1e 100644 --- a/server/src/test/kotlin/com/fone/common/CommonProfileCallApi.kt +++ b/server/src/test/kotlin/com/fone/common/CommonProfileCallApi.kt @@ -2,43 +2,70 @@ package com.fone.common import com.fone.common.entity.Career import com.fone.common.entity.CategoryType +import com.fone.common.entity.ContactMethod import com.fone.common.entity.DomainType import com.fone.common.entity.Gender import com.fone.common.entity.Type import com.fone.common.response.CommonResponse +import com.fone.jobOpening.presentation.dto.ValidateJobOpeningDto import com.fone.profile.domain.enum.SNS import com.fone.profile.presentation.dto.RegisterProfileDto.RegisterProfileRequest +import com.fone.profile.presentation.dto.ValidateProfileDto import com.fone.profile.presentation.dto.common.ProfileSnsUrl import org.springframework.test.web.reactive.server.WebTestClient import java.time.LocalDate object CommonProfileCallApi { - private val registerUrl = "/api/v1/profiles" - - fun register(client: WebTestClient, accessToken: String): Long { - val snsUrls = listOf( - ProfileSnsUrl("https://www.instagram.com/test", SNS.INSTAGRAM), - ProfileSnsUrl("https://www.youtube.com/test", SNS.YOUTUBE) - ) - val registerProfileActorRequest = RegisterProfileRequest( + val registerProfileActorRequest = RegisterProfileRequest( + firstPage = ValidateJobOpeningDto.FirstPage( + contactMethod = ContactMethod.EMAIL, + contact = "https://docs.google.com/forms/..." + ), + secondPage = ValidateProfileDto.SecondPage( name = "테스트 이름", hookingComment = "테스트 후킹 멘트", - birthday = LocalDate.now(), - gender = Gender.IRRELEVANT, + profileImages = listOf("test profile url"), + representativeImageUrl = "test profile url" + ), + thirdPage = ValidateProfileDto.ThirdPage( + birthday = LocalDate.ofYearDay(2020, 1), + gender = Gender.MAN, height = 180, weight = 70, - email = "test12345@test.com", - sns = "test sns", - snsUrls = snsUrls, + email = "test@test.com", specialty = "test", - details = "test", + domains = null, + snsUrls = listOf( + ProfileSnsUrl("https://www.instagram.com/test", SNS.INSTAGRAM), + ProfileSnsUrl("https://www.youtube.com/test", SNS.YOUTUBE) + ) + ), + fourthPage = ValidateProfileDto.FourthPage( + details = "test" + ), + fifthPage = ValidateProfileDto.FifthPage( career = Career.IRRELEVANT, - careerDetail = "test", - categories = listOf(CategoryType.ETC), - type = Type.ACTOR, - domains = listOf(DomainType.PAINTING), - profileImages = listOf("test profile url"), - representativeImageUrl = "test profile url" + careerDetail = "test" + ), + sixthPage = ValidateProfileDto.SixthPage( + categories = listOf(CategoryType.ETC) + ), + type = Type.ACTOR + ) + + val registerProfileStaffRequest = registerProfileActorRequest.copy( + type = Type.STAFF, + thirdPage = registerProfileActorRequest.thirdPage.copy( + domains = listOf(DomainType.PAINTING) + ) + ) + + private val registerUrl = "/api/v1/profiles" + + fun register(client: WebTestClient, accessToken: String): Long { + val snsUrls = listOf( + ProfileSnsUrl("https://www.instagram.com/test", SNS.INSTAGRAM), + ProfileSnsUrl("https://www.youtube.com/test", SNS.YOUTUBE) ) val profile = diff --git a/server/src/test/kotlin/com/fone/etc/HttpModelFailureResponseTest.kt b/server/src/test/kotlin/com/fone/etc/HttpModelFailureResponseTest.kt index da767e60..e3e2392f 100644 --- a/server/src/test/kotlin/com/fone/etc/HttpModelFailureResponseTest.kt +++ b/server/src/test/kotlin/com/fone/etc/HttpModelFailureResponseTest.kt @@ -8,16 +8,9 @@ import com.fone.common.CommonUserCallApi import com.fone.common.CustomDescribeSpec import com.fone.common.IntegrationTest import com.fone.common.doPut -import com.fone.common.entity.Career -import com.fone.common.entity.CategoryType -import com.fone.common.entity.DomainType -import com.fone.common.entity.Gender -import com.fone.common.entity.Type import com.fone.common.response.CommonResponse -import com.fone.profile.presentation.dto.RegisterProfileDto.RegisterProfileRequest import io.kotest.matchers.string.shouldContain import org.springframework.test.web.reactive.server.WebTestClient -import java.time.LocalDate @IntegrationTest class HttpModelFailureResponseTest( @@ -31,30 +24,12 @@ class HttpModelFailureResponseTest( val (accessToken, _) = CommonUserCallApi.getAccessToken(client) val profileId = CommonProfileCallApi.register(client, accessToken) - val putJobOpeningActorRequest = RegisterProfileRequest( - name = "테스트 이름", - hookingComment = "테스트 후킹 멘트", - birthday = LocalDate.now(), - gender = Gender.IRRELEVANT, - height = 180, - weight = 70, - email = "test12345@test.com", - sns = "test sns", - specialty = "test", - details = "test", - career = Career.IRRELEVANT, - careerDetail = "test", - categories = listOf(CategoryType.ETC), - type = Type.ACTOR, - domains = listOf(DomainType.PAINTING), - profileImages = listOf("test profile url"), - representativeImageUrl = "test profile url" - ) + val putProfileActorRequest = CommonProfileCallApi.registerProfileActorRequest describe("#실패 요청") { context("PUT 요청에 필수 필드 빠지면") { it("실패하고 빠진 필드 정보 돌려준다") { - val requestBody = objectMapper.convertValue>(putJobOpeningActorRequest) + val requestBody = objectMapper.convertValue>(putProfileActorRequest) requestBody.remove("type") // request에 Type 제거 client .doPut("$putUrl/$profileId", requestBody, accessToken) diff --git a/server/src/test/kotlin/com/fone/profile/presentation/controller/PutProfileControllerTest.kt b/server/src/test/kotlin/com/fone/profile/presentation/controller/PutProfileControllerTest.kt index 029e8527..612fb2ef 100644 --- a/server/src/test/kotlin/com/fone/profile/presentation/controller/PutProfileControllerTest.kt +++ b/server/src/test/kotlin/com/fone/profile/presentation/controller/PutProfileControllerTest.kt @@ -7,23 +7,16 @@ import com.fone.common.CommonUserCallApi import com.fone.common.CustomDescribeSpec import com.fone.common.IntegrationTest import com.fone.common.doPut -import com.fone.common.entity.Career -import com.fone.common.entity.CategoryType -import com.fone.common.entity.DomainType -import com.fone.common.entity.Gender -import com.fone.common.entity.Type import com.fone.common.response.CommonResponse import com.fone.profile.domain.entity.ProfileSns import com.fone.profile.domain.enum.SNS import com.fone.profile.domain.repository.ProfileRepository import com.fone.profile.presentation.dto.RegisterProfileDto -import com.fone.profile.presentation.dto.RegisterProfileDto.RegisterProfileRequest import com.fone.profile.presentation.dto.common.ProfileSnsUrl import com.fone.profile.presentation.dto.common.toDto import io.kotest.common.runBlocking import io.kotest.matchers.shouldBe import org.springframework.test.web.reactive.server.WebTestClient -import java.time.LocalDate @IntegrationTest class PutProfileControllerTest( @@ -38,35 +31,17 @@ class PutProfileControllerTest( val (accessToken, _) = CommonUserCallApi.getAccessToken(client) val profileId = CommonProfileCallApi.register(client, accessToken) val snsUrls = listOf( - ProfileSnsUrl("https://www.instagram.com", SNS.INSTAGRAM), - ProfileSnsUrl("https://www.youtube.com/", SNS.YOUTUBE) + ProfileSnsUrl("https://www.instagram.com/test", SNS.INSTAGRAM), + ProfileSnsUrl("https://www.youtube.com/test", SNS.YOUTUBE) ) - val putJobOpeningActorRequest = RegisterProfileRequest( - name = "테스트 이름", - hookingComment = "테스트 후킹 멘트", - birthday = LocalDate.now(), - gender = Gender.IRRELEVANT, - height = 180, - weight = 70, - email = "test12345@test.com", - specialty = "test", - details = "test", - career = Career.IRRELEVANT, - careerDetail = "test", - categories = listOf(CategoryType.ETC), - type = Type.ACTOR, - domains = listOf(DomainType.PAINTING), - profileImages = listOf("test profile url"), - representativeImageUrl = "test profile url", - snsUrls = snsUrls - ) + val putProfileActorRequest = CommonProfileCallApi.registerProfileActorRequest describe("#put profile") { context("존재하는 프로필을 수정하면") { it("성공한다") { client - .doPut("$putUrl/$profileId", putJobOpeningActorRequest, accessToken) + .doPut("$putUrl/$profileId", putProfileActorRequest, accessToken) .expectStatus() .isOk .expectBody() @@ -75,7 +50,7 @@ class PutProfileControllerTest( objectMapper.readValue>( it.responseBody!! ) - response.data!!.profile.snsUrls.toSet() shouldBe snsUrls.toSet() + response.data!!.profile.thirdPage.snsUrls.toSet() shouldBe snsUrls.toSet() runBlocking { profileRepository.findById(profileId)!!.snsUrls.map(ProfileSns::toDto) .toSet() shouldBe snsUrls.toSet() @@ -89,7 +64,7 @@ class PutProfileControllerTest( context("존재하지 않는 프로필을 수정하면") { it("실패한다") { client - .doPut("$putUrl/1231", putJobOpeningActorRequest, accessToken) + .doPut("$putUrl/1231", putProfileActorRequest, accessToken) .expectStatus() .isBadRequest .expectBody() diff --git a/server/src/test/kotlin/com/fone/profile/presentation/controller/RegisterProfileControllerTest.kt b/server/src/test/kotlin/com/fone/profile/presentation/controller/RegisterProfileControllerTest.kt index c8d96472..1f49565a 100644 --- a/server/src/test/kotlin/com/fone/profile/presentation/controller/RegisterProfileControllerTest.kt +++ b/server/src/test/kotlin/com/fone/profile/presentation/controller/RegisterProfileControllerTest.kt @@ -2,23 +2,17 @@ package com.fone.profile.presentation.controller import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.readValue +import com.fone.common.CommonProfileCallApi import com.fone.common.CommonUserCallApi import com.fone.common.CustomDescribeSpec import com.fone.common.IntegrationTest import com.fone.common.doPost -import com.fone.common.entity.Career -import com.fone.common.entity.CategoryType -import com.fone.common.entity.DomainType -import com.fone.common.entity.Gender -import com.fone.common.entity.Type import com.fone.common.response.CommonResponse import com.fone.profile.domain.enum.SNS import com.fone.profile.presentation.dto.RegisterProfileDto -import com.fone.profile.presentation.dto.RegisterProfileDto.RegisterProfileRequest import com.fone.profile.presentation.dto.common.ProfileSnsUrl import io.kotest.matchers.shouldBe import org.springframework.test.web.reactive.server.WebTestClient -import java.time.LocalDate @IntegrationTest class RegisterProfileControllerTest(objectMapper: ObjectMapper, client: WebTestClient) : CustomDescribeSpec() { @@ -28,49 +22,13 @@ class RegisterProfileControllerTest(objectMapper: ObjectMapper, client: WebTestC init { val (accessToken, _) = CommonUserCallApi.getAccessToken(client) val snsUrls = listOf( - ProfileSnsUrl("https://www.instagram.com", SNS.INSTAGRAM), - ProfileSnsUrl("https://www.youtube.com/", SNS.YOUTUBE) + ProfileSnsUrl("https://www.instagram.com/test", SNS.INSTAGRAM), + ProfileSnsUrl("https://www.youtube.com/test", SNS.YOUTUBE) ) - val registerProfileActorRequest = RegisterProfileRequest( - name = "테스트 이름", - hookingComment = "테스트 후킹 멘트", - birthday = LocalDate.now(), - gender = Gender.IRRELEVANT, - height = 180, - weight = 70, - email = "test12345@test.com", - specialty = "test", - details = "test", - career = Career.IRRELEVANT, - careerDetail = "test", - categories = listOf(CategoryType.ETC), - type = Type.ACTOR, - domains = listOf(DomainType.PAINTING), - profileImages = listOf("test profile url"), - representativeImageUrl = "test profile url", - snsUrls = snsUrls - ) + val registerProfileActorRequest = CommonProfileCallApi.registerProfileActorRequest - val registerProfileStaffRequest = RegisterProfileRequest( - name = "테스트 이름", - hookingComment = "테스트 후킹 멘트", - birthday = LocalDate.now(), - gender = Gender.IRRELEVANT, - height = 180, - weight = 70, - email = "test12345@test.com", - specialty = "test", - details = "test", - career = Career.IRRELEVANT, - careerDetail = "test", - categories = listOf(CategoryType.ETC), - type = Type.ACTOR, - domains = listOf(DomainType.PAINTING), - profileImages = listOf("test profile url"), - representativeImageUrl = "test profile url", - snsUrls = snsUrls - ) + val registerProfileStaffRequest = CommonProfileCallApi.registerProfileStaffRequest describe("#register profile") { context("유효한 정보로 배우 프로필을 등록 하면") { @@ -82,7 +40,7 @@ class RegisterProfileControllerTest(objectMapper: ObjectMapper, client: WebTestC objectMapper.readValue>( it.responseBody!! ) - response.data!!.profile.snsUrls.toSet() shouldBe snsUrls.toSet() + response.data!!.profile.thirdPage.snsUrls.toSet() shouldBe snsUrls.toSet() } .jsonPath("$.result") .isEqualTo("SUCCESS") diff --git a/server/src/test/kotlin/com/fone/profile/presentation/controller/ValidateProfileControllerTest.kt b/server/src/test/kotlin/com/fone/profile/presentation/controller/ValidateProfileControllerTest.kt index d39e822a..60c6ffe6 100644 --- a/server/src/test/kotlin/com/fone/profile/presentation/controller/ValidateProfileControllerTest.kt +++ b/server/src/test/kotlin/com/fone/profile/presentation/controller/ValidateProfileControllerTest.kt @@ -20,10 +20,11 @@ class ValidateProfileControllerTest(client: WebTestClient) : CustomDescribeSpec( context("basic 페이지") { it("성공한다") { val request = - ValidateProfileDto.BasicPageValidation( + ValidateProfileDto.SecondPage( "제목", "후킹멘트", - listOf("https://s3-ap-northeast-2.amazonaws.com/f-one-image/prod/user-profile/image.jpg") + listOf("https://s3-ap-northeast-2.amazonaws.com/f-one-image/prod/user-profile/image.jpg"), + "https://s3-ap-northeast-2.amazonaws.com/f-one-image/prod/user-profile/image.jpg" ) client.doPost("$url/basic", request, accessToken) .expectStatus().isOk.expectBody() @@ -31,10 +32,11 @@ class ValidateProfileControllerTest(client: WebTestClient) : CustomDescribeSpec( } it("실패한다") { val request = - ValidateProfileDto.BasicPageValidation( + ValidateProfileDto.SecondPage( "제목", "후킹멘트", - listOf("") + listOf(""), + "" ) client.doPost("$url/basic", request, accessToken).expectStatus().isBadRequest.expectBody() .consumeWith { println(it) }.jsonPath("$.result").isEqualTo("FAIL") @@ -43,7 +45,7 @@ class ValidateProfileControllerTest(client: WebTestClient) : CustomDescribeSpec( context("details 페이지") { it("성공한다") { val request = - ValidateProfileDto.DetailPageValidation( + ValidateProfileDto.ThirdPage( LocalDate.now(), Gender.MAN, 170, @@ -59,7 +61,7 @@ class ValidateProfileControllerTest(client: WebTestClient) : CustomDescribeSpec( } it("실패한다") { val request = - ValidateProfileDto.DetailPageValidation( + ValidateProfileDto.ThirdPage( LocalDate.now(), Gender.MAN, null,