Skip to content

Commit

Permalink
Merge pull request #164 from teamterning/staging
Browse files Browse the repository at this point in the history
[🎉 deploy] 터닝 운영서버 배포
  • Loading branch information
JungYoonShin authored Oct 21, 2024
2 parents b1684ef + d564fc9 commit a0c0d1f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ public List<InternshipAnnouncement> getMostScrappedInternship() {

@Override
public Page<InternshipAnnouncement> searchInternshipAnnouncement(String keyword, String sortBy, Pageable pageable) {
keyword = keyword.toLowerCase();

List<InternshipAnnouncement> internshipAnnouncements = jpaQueryFactory
.selectFrom(internshipAnnouncement)
.where(contentLike(keyword))
.where(contentLike(keyword, isPureEnglish(keyword)))
.orderBy(sortAnnouncementsByDeadline().asc(), createOrderSpecifier(sortBy))
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
Expand All @@ -75,14 +76,24 @@ public Page<InternshipAnnouncement> searchInternshipAnnouncement(String keyword,
JPAQuery<Long> count = jpaQueryFactory
.select(internshipAnnouncement.count())
.from(internshipAnnouncement)
.where(contentLike(keyword));
.where(contentLike(keyword, isPureEnglish(keyword)));


return PageableExecutionUtils.getPage(internshipAnnouncements, pageable, count::fetchOne);
}

private BooleanExpression contentLike(String keyword) {
return internshipAnnouncement.title.contains(keyword);
private boolean isPureEnglish(String summonerName) {
//공백은 무시
return summonerName.replaceAll("\\s", "").matches("^[a-zA-Z]+$");
}

private BooleanExpression contentLike(String keyword, boolean isPureEnglish) {
if(isPureEnglish) {
return Expressions.stringTemplate("LOWER({0})", internshipAnnouncement.title).contains(keyword);
} else {
keyword = keyword.replaceAll("\\s", "");
return Expressions.stringTemplate("REPLACE(LOWER({0}), ' ', '')", internshipAnnouncement.title).contains(keyword);
}
}

//정렬 조건(5가지, 채용 마감 이른 순, 짧은 근무 기간 순, 긴 근무 기간 순,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ public class WebhookService {
// 알림을 보내는 메서드
public void sendDiscordNotification(User user) {

// discord.webhook.url 값이 비어있으면 웹훅을 실행하지 않음
if (discordWebhookUrl == null || discordWebhookUrl.isEmpty()) {
// 스테이징 환경에서는 웹훅을 비활성화
return;
}

// REST 요청을 처리하기 위한 RestTemplate 객체 생성
RestTemplate restTemplate = new RestTemplate();

Expand Down

0 comments on commit a0c0d1f

Please sign in to comment.