Skip to content

Commit

Permalink
Release/v1.0.2 (#175)
Browse files Browse the repository at this point in the history
* [IDLE-000] Production CI 스크립트 작성

* [IDLE-000] 센터 공고 수정 API 내 접수 방법 null 비허용

* [IDLE-000] 공고 지원자 조회 시, 삭제된 유저는 조회되지 않도록 수정

* [IDLE-363] 센터 관리자 전화 인증 요청 API

* [IDLE-363] 개발 환경 ddl-auto 옵션 임시로 create 옵션으로 변경

* [IDLE-365] 공고 크롤러 selenium 로직 수정 및 로컬 동작 확인

* [IDLE-365] 테스트를 위한 스케줄러 기준 시각 변경

* [IDLE-365] batch job enable 옵션 비활성화

* [IDLE-365] ddl-auto update로 변경

* [IDLE-365] 크롤링 공고 필드 null 비허용

* [IDLE-365] 스케줄러 시간 02시로 설정

* [IDLE-366] spring batch selenium 크롤링을 위한 빌드 스크립트 수정

* [IDLE-366] worknet 사이트가 고용 24 사이트로 통합됨에 따라, 크롤링 스크립트 수정

* [IDLE-366] 크롤러 동작 스케줄링 시간 변경

* [IDLE-366] 스프링 초기 실행 시, spring batch 자동 실행 방지 옵션 추가

* [IDLE-366] spring batch 5 버전에서 업데이트 된 변경사항 적용 및 별도의 JobLauncher 구현

* [IDLE-366] 불필요 의존성 및 옵션 제거

* [IDLE-366] 크롤링 조회 API 내 entity status 필드 추가 및 쿼리 수정

* [IDLE-358] 운영 환경 CD 구축 및 운영 환경 profile 설정 추가

* [IDLE-358] 운영 환경 docker run 실행 시 예외 처리

* [IDLE-000] 크롤링 전체 조회 DTO 생성자 추가

* [IDLE-000] 공고 전체 조회 fetchJoin() 중복 이슈 해결을 위한 subquery 분리

* [IDLE-000] AI 코드리뷰 coderabbit 도입

* [IDLE-000] 크롤링 공고 반경범위 조회 필터를 위한 where절 추가

* [IDLE-000] TimeZone 설정이 적용되지 않는 문제 해결

* [IDLE-000] TimeZone 지정 및 @EnableScheduling 설정

* [IDLE-000] TimeZone 설정 제거

* [IDLE-000] 공고 전체 조회 쿼리 롤백

* [IDLE-000] 기존 공고 내 location을 기반으로 위.경도 값을 decoding하도록 변경

* [IDLE-000] 배포 전 최종 QA

* [IDLE-000] 크롤링 공고 생성일자 필드 type 변경(timestamp -> date)

* [IDLE-000] Redis 비밀번호 설정 추가 (#171)

* [IDLE-000] Redis 비밀번호 설정 추가

* [IDLE-000] yaml 파일에 password 필드 추가

* [IDLE-000] redis local default password 설정

* [IDLE-000] compose 파일 내, 비밀번호 지정 command 설정

* [IDLE-000] Redis 볼륨 설정

* [IDLE-000] ci triggering branch 임시 변경

* [IDLE-000] ci triggering branch 롤백

* [IDLE-000] 테스트 심사 통과를 위한 전화번호 검증 로직 추가
  • Loading branch information
wonjunYou authored Sep 25, 2024
1 parent 4a379b6 commit 2270fc4
Show file tree
Hide file tree
Showing 16 changed files with 85 additions and 37 deletions.
1 change: 1 addition & 0 deletions .github/workflows/prod-server-deployer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ jobs:
key: ${{ secrets.INSTANCE_PEM_KEY }}
script: |
sudo docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
sudo docker pull public.ecr.aws/f5q3r6m5/idle-prod-ecr:latest
if sudo docker ps -q -f name=caremeet_server_prod; then
sudo docker stop caremeet_server_prod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.swm.idle.domain.jobposting.enums.PayType
import com.swm.idle.domain.jobposting.repository.jpa.JobPostingJpaRepository
import com.swm.idle.domain.jobposting.repository.querydsl.JobPostingQueryRepository
import com.swm.idle.domain.jobposting.repository.querydsl.JobPostingSpatialQueryRepository
import com.swm.idle.domain.user.carer.entity.jpa.Carer
import com.swm.idle.domain.user.common.enum.GenderType
import com.swm.idle.domain.user.common.vo.BirthYear
import org.locationtech.jts.geom.Point
Expand Down Expand Up @@ -194,11 +195,13 @@ class JobPostingService(
}

fun findAllByCarerLocationInRange(
carer: Carer,
location: Point,
next: UUID?,
limit: Long,
): List<JobPostingPreviewDto> {
return jobPostingSpatialQueryRepository.findAllWithWeekdaysInRange(
carer = carer,
location = location,
next = next,
limit = limit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,23 @@ class CarerJobPostingFacadeService(
next: UUID?,
limit: Long,
): Pair<List<JobPostingPreviewDto>, UUID?> {
val carer = getUserAuthentication().userId.let {
carerService.getById(it)
}

val jobPostingPreviewDtos = jobPostingService.findAllByCarerLocationInRange(
carer = carer,
location = location,
next = next,
limit = limit + 1,
)

val carerLocation = getUserAuthentication().userId.let {
carerService.getById(it)
}.let {
PointConverter.convertToPoint(
latitude = it.latitude.toDouble(),
longitude = it.longitude.toDouble(),
)
}

val carerLocation = PointConverter.convertToPoint(
latitude = carer.latitude.toDouble(),
longitude = carer.longitude.toDouble(),
)


for (jobPostingPreviewDto in jobPostingPreviewDtos) {
jobPostingPreviewDto.distance = jobPostingService.calculateDistance(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ class AuthFacadeService(
phoneNumber: PhoneNumber,
verificationNumber: UserPhoneVerificationNumber,
) {
// 앱 심사 통과를 위한 임시 로직
if (phoneNumber.value.equals("010-1234-5678")) {
return
}

userPhoneVerificationService.findByPhoneNumber(phoneNumber)?.let {
if (it.first != phoneNumber || it.second != verificationNumber) {
throw UserException.InvalidVerificationNumber()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.swm.idle.batch.common.dto
import com.swm.idle.domain.jobposting.entity.jpa.CrawledJobPosting
import com.swm.idle.support.common.uuid.UuidCreator
import org.locationtech.jts.geom.Point
import java.time.LocalDateTime
import java.time.LocalDate
import java.time.format.DateTimeFormatter

data class CrawledJobPostingDto(
Expand All @@ -29,9 +29,9 @@ data class CrawledJobPostingDto(
title = title,
content = content,
clientAddress = clientAddress,
createdAt = LocalDateTime.parse(
createdAt,
DateTimeFormatter.ofPattern("yyyy.MM.dd HH:mm:ss")
createdAt = LocalDate.parse(
createdAt.substring(0, 10),
DateTimeFormatter.ofPattern("yyyy.MM.dd")
),
payInfo = payInfo,
workTime = workTime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class CrawlingJobConfig(
fun crawlingJobPostStep(): Step {
return StepBuilder("crawlingJobPostStep", jobRepository)
.tasklet(crawlingJobPostingTasklet, transactionManager)
.allowStartIfComplete(true)
.build()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.data.redis.connection.RedisConnectionFactory
import org.springframework.data.redis.connection.RedisPassword
import org.springframework.data.redis.connection.RedisStandaloneConfiguration
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory
import org.springframework.data.redis.core.RedisTemplate
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories
Expand All @@ -18,7 +20,13 @@ class RedisConfig(

@Bean
fun connectionFactory(): RedisConnectionFactory {
return LettuceConnectionFactory(redisProperties.host, redisProperties.port)
RedisStandaloneConfiguration().apply {
hostName = redisProperties.host
port = redisProperties.port
password = RedisPassword.of(redisProperties.password)
}.also {
return LettuceConnectionFactory(it)
}
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ data class JobPostingPreviewDto(

constructor(
jobPosting: JobPosting,
jobPostingWeekdays: List<JobPostingWeekday>,
jobPostingWeekdays: Set<JobPostingWeekday>,
applyTime: LocalDateTime?,
) : this(jobPosting, jobPostingWeekdays, 0, applyTime, true)
) : this(jobPosting, jobPostingWeekdays.toList(), 0, applyTime, true)

constructor(
jobPosting: JobPosting,
jobPostingWeekdays: List<JobPostingWeekday>,
jobPostingWeekdays: Set<JobPostingWeekday>,
applyTime: LocalDateTime?,
isFavorite: Boolean,
) : this(jobPosting, jobPostingWeekdays, 0, applyTime, isFavorite)
) : this(jobPosting, jobPostingWeekdays.toList(), 0, applyTime, isFavorite)

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ import org.springframework.boot.context.properties.ConfigurationProperties
data class RedisProperties(
val host: String,
val port: Int,
val password: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import jakarta.persistence.Enumerated
import jakarta.persistence.Id
import jakarta.persistence.Table
import org.locationtech.jts.geom.Point
import java.time.LocalDateTime
import java.time.LocalDate
import java.util.*

@Entity
Expand All @@ -28,7 +28,7 @@ class CrawledJobPosting(
centerName: String,
centerAddress: String,
directUrl: String,
createdAt: LocalDateTime,
createdAt: LocalDate,
location: Point,
) {

Expand Down Expand Up @@ -88,8 +88,8 @@ class CrawledJobPosting(
var directUrl: String = directUrl
private set

@Column(columnDefinition = "timestamp")
var createdAt: LocalDateTime = createdAt
@Column(columnDefinition = "date")
var createdAt: LocalDate = createdAt
private set

@Column(columnDefinition = "POINT SRID 4326")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.swm.idle.domain.jobposting.repository.querydsl

import com.querydsl.core.group.GroupBy.groupBy
import com.querydsl.core.group.GroupBy.list
import com.querydsl.core.group.GroupBy.set
import com.querydsl.core.types.Projections
import com.querydsl.jpa.impl.JPAQueryFactory
import com.swm.idle.domain.applys.entity.jpa.QApplys.applys
Expand Down Expand Up @@ -54,7 +54,7 @@ class JobPostingQueryRepository(
Projections.constructor(
JobPostingPreviewDto::class.java,
jobPosting,
list(jobPostingWeekday),
set(jobPostingWeekday),
applys.createdAt,
jobPostingFavorite.id.isNotNull
.and(jobPostingFavorite.entityStatus.eq(EntityStatus.ACTIVE))
Expand Down Expand Up @@ -83,7 +83,7 @@ class JobPostingQueryRepository(
Projections.constructor(
JobPostingPreviewDto::class.java,
jobPosting,
list(jobPostingWeekday),
set(jobPostingWeekday),
applys.createdAt ?: null,
)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.swm.idle.domain.jobposting.repository.querydsl

import com.querydsl.core.group.GroupBy.groupBy
import com.querydsl.core.group.GroupBy.list
import com.querydsl.core.group.GroupBy.set
import com.querydsl.core.types.Projections
import com.querydsl.core.types.dsl.BooleanExpression
import com.querydsl.core.types.dsl.Expressions
Expand All @@ -13,6 +13,7 @@ import com.swm.idle.domain.jobposting.entity.jpa.QJobPosting.jobPosting
import com.swm.idle.domain.jobposting.entity.jpa.QJobPostingFavorite.jobPostingFavorite
import com.swm.idle.domain.jobposting.entity.jpa.QJobPostingWeekday.jobPostingWeekday
import com.swm.idle.domain.jobposting.enums.JobPostingStatus
import com.swm.idle.domain.user.carer.entity.jpa.Carer
import org.locationtech.jts.geom.Point
import org.springframework.stereotype.Repository
import java.util.*
Expand All @@ -23,6 +24,7 @@ class JobPostingSpatialQueryRepository(
) {

fun findAllWithWeekdaysInRange(
carer: Carer,
location: Point,
next: UUID?,
limit: Long,
Expand All @@ -44,12 +46,20 @@ class JobPostingSpatialQueryRepository(
}

return jpaQueryFactory
.selectDistinct(jobPosting, jobPostingWeekday, jobPostingFavorite, applys)
.selectDistinct(
jobPosting,
jobPostingWeekday,
applys,
jobPostingFavorite
)
.from(jobPosting)
.leftJoin(jobPostingWeekday).fetchJoin()
.innerJoin(jobPostingWeekday)
.on(jobPosting.id.eq(jobPostingWeekday.jobPostingId))
.leftJoin(applys).fetchJoin()
.on(jobPosting.id.eq(applys.jobPostingId))
.leftJoin(applys)
.on(
jobPosting.id.eq(applys.jobPostingId)
.and(applys.carerId.eq(carer.id))
)
.leftJoin(jobPostingFavorite).fetchJoin()
.on(jobPosting.id.eq(jobPostingFavorite.jobPostingId))
.where(jobPosting.id.`in`(jobPostingIds))
Expand All @@ -59,10 +69,14 @@ class JobPostingSpatialQueryRepository(
Projections.constructor(
JobPostingPreviewDto::class.java,
jobPosting,
list(jobPostingWeekday),
set(jobPostingWeekday),
applys.createdAt ?: null,
jobPostingFavorite.id.isNotNull
.and(jobPostingFavorite.entityStatus.eq(EntityStatus.ACTIVE))
Expressions.booleanTemplate(
"case when {0} is not null and {1} = {2} then true else false end",
jobPostingFavorite.id,
jobPostingFavorite.entityStatus,
EntityStatus.ACTIVE
)
)
)
)
Expand Down
1 change: 1 addition & 0 deletions idle-domain/src/main/resources/application-domain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ spring:
redis:
host: ${REDIS_HOST:localhost}
port: ${REDIS_PORT:6379}
password: ${REDIS_PASSWORD:redis}
---
spring:
config:
Expand Down
7 changes: 7 additions & 0 deletions idle-presentation/compose-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ services:
container_name: redis_dev
ports:
- "6379:6379"
environment:
REDIS_PASSWORD: ${REDIS_PASSWORD}
command: [ "redis-server", "--requirepass", "$REDIS_PASSWORD" ]
volumes:
- redis-volume:/data
restart: unless-stopped

volumes:
mysql-volume:
redis-volume:
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty
import com.swm.idle.domain.jobposting.entity.jpa.CrawledJobPosting
import com.swm.idle.domain.jobposting.enums.JobPostingType
import io.swagger.v3.oas.annotations.media.Schema
import java.time.LocalDateTime
import java.time.LocalDate
import java.util.*

@Schema(
Expand Down Expand Up @@ -46,7 +46,7 @@ data class CrawlingJobPostingFavoriteResponse(
val jobPostingType: JobPostingType = JobPostingType.WORKNET,

@Schema(description = "공고 생성 시각")
val createdAt: LocalDateTime?,
val createdAt: LocalDate?,
) {

companion object {
Expand All @@ -61,7 +61,7 @@ data class CrawlingJobPostingFavoriteResponse(
workingTime = crawledJobPosting.workTime,
workingSchedule = crawledJobPosting.workSchedule,
payInfo = crawledJobPosting.payInfo,
applyDeadline = crawledJobPosting.applyDeadline.toString(),
applyDeadline = crawledJobPosting.applyDeadline,
distance = distance,
isFavorite = true,
createdAt = crawledJobPosting.createdAt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty
import com.swm.idle.domain.jobposting.entity.jpa.CrawledJobPosting
import com.swm.idle.domain.jobposting.enums.JobPostingType
import io.swagger.v3.oas.annotations.media.Schema
import java.time.LocalDateTime
import java.time.LocalDate
import java.util.*

@Schema(
Expand All @@ -14,6 +14,9 @@ import java.util.*
data class CrawlingJobPostingResponse(
val id: UUID,

@Schema(description = "공고 제목")
val title: String?,

@Schema(description = "모집 요강")
val content: String?,

Expand All @@ -27,7 +30,7 @@ data class CrawlingJobPostingResponse(
val latitude: String?,

@Schema(description = "생성 시각")
val createdAt: LocalDateTime?,
val createdAt: LocalDate?,

@Schema(description = "급여 정보")
val payInfo: String?,
Expand Down Expand Up @@ -82,6 +85,7 @@ data class CrawlingJobPostingResponse(
): CrawlingJobPostingResponse {
return CrawlingJobPostingResponse(
id = crawlingJobPosting.id,
title = crawlingJobPosting.title,
content = crawlingJobPosting.content,
clientAddress = crawlingJobPosting.clientAddress,
longitude = longitude.toString(),
Expand Down

0 comments on commit 2270fc4

Please sign in to comment.