Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: 최근 추가 경험 순 정렬 기능 추가 #176

Merged
merged 4 commits into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .deploy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ ARG JAR_FILE=/Api-Module/build/libs/Api-Module-0.0.1-SNAPSHOT.jar
COPY ${JAR_FILE} app.jar

# 빌드된 이미지가 run될 때 실행할 명령어
ENTRYPOINT ["java","-jar","app.jar"]
ENTRYPOINT ["java","-jar","app.jar"]
3 changes: 2 additions & 1 deletion .deploy/docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ services:
- JWT_SECRET=${JWT_SECRET}
- JWT_ACCESS_TOKEN_EXPIRATION_TIME=${JWT_ACCESS_TOKEN_EXPIRATION_TIME}
- JWT_REFRESH_TOKEN_EXPIRATION_TIME=${JWT_REFRESH_TOKEN_EXPIRATION_TIME}
- JWT_REGISTRATION_TOKEN_EXPIRATION_TIME=${JWT_REGISTRATION_TOKEN_EXPIRATION_TIME}
- JWT_REGISTRATION_TOKEN_EXPIRATION_TIME=${JWT_REGISTRATION_TOKEN_EXPIRATION_TIME}
- KEY_STORE_PASSWORD=${KEY_STORE_PASSWORD}
1 change: 1 addition & 0 deletions .github/workflows/CD-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
echo "JWT_ACCESS_TOKEN_EXPIRATION_TIME=${{ secrets.JWT_ACCESS_TOKEN_EXPIRATION_TIME }}" >> ./.env
echo "JWT_REFRESH_TOKEN_EXPIRATION_TIME=${{ secrets.JWT_REFRESH_TOKEN_EXPIRATION_TIME }}" >> ./.env
echo "JWT_REGISTRATION_TOKEN_EXPIRATION_TIME=${{ secrets.JWT_REGISTRATION_TOKEN_EXPIRATION_TIME }}" >> ./.env
echo "KEY_STORE_PASSWORD=${{ secrets.KEY_STORE_PASSWORD }}" >> ./.env

# gradle build
- name: Grant execute permission for gradlew
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ExperienceGetService(
.distinctBy { it.parentTagId }
.map { it.parentTagId }

val tagDetails = tagReader.readByParentTagIds(parentTagIds).map {
val tagDetails = tagReader.readByParentTagIdsAndYearAndExperienceCreatedAtDesc(parentTagIds, year).map {
ExperienceYear.TagDetail(
id = it.id,
name = it.name
Expand Down Expand Up @@ -111,7 +111,7 @@ class ExperienceGetService(
val bookmarkExperienceIds =
bookMarkReader.readByBookmarkStatusAndExperienceIds(experiencesIds, BookmarkStatus.ON)
.map { it.experienceId }
println(bookmarkExperienceIds)

val bookmarkExperienceDetails = searchExperiences.map {
when {
it.id in bookmarkExperienceIds -> createBookmarkExperienceDetailResponse(it, BookmarkStatus.ON)
Expand Down Expand Up @@ -249,7 +249,6 @@ class ExperienceGetService(
private fun convertStrongPoints(strongPoints: List<ExperienceStrongPoint>) : List<GetExperience.DetailStrongPoint> {
val strongPointIds = strongPoints.map { it.strongPointId }
val defaultStrongPoints = keywordReader.readByIds(strongPointIds)
println(defaultStrongPoints)
val targetStrongPointIds = strongPointIds.union(defaultStrongPoints.map { it.id }).toList()

val customStrongPointDetails = strongPointReader.readByIds(targetStrongPointIds).map { strongPoint ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import com.bamyanggang.apimodule.domain.experience.application.service.Experienc
import com.bamyanggang.apimodule.domain.experience.application.service.ExperienceDeleteService
import com.bamyanggang.apimodule.domain.experience.application.service.ExperienceEditService
import com.bamyanggang.apimodule.domain.experience.application.service.ExperienceGetService
import com.bamyanggang.persistence.strongpoint.jpa.repository.KeywordJpaRepository
import com.bamyanggang.persistence.strongpoint.mapper.KeywordMapper
import org.springframework.web.bind.annotation.*
import java.util.*

Expand Down
7 changes: 6 additions & 1 deletion Api-Module/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
server:
shutdown: graceful
port: 8080
ssl:
key-store: /ssl/keystore.p12
key-store-type: PKCS12
key-store-password: ${KEY_STORE_PASSWORD}

spring:
profiles:
include:
- db
- jwt
- jwt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ interface TagRepository {
fun findByParentTagIds(tagParentTagIds: List<UUID>): List<Tag>
fun findByUserIdAndNameContains(userId: UUID, search: String): List<Tag>
fun findAllChildTagsByParentTagId(parentTagId: UUID) : List<Tag>
fun findByParentTagIdsAndYearAndExperienceCreatedAtDesc(parentTagIds: List<UUID>, year: Int): List<Tag>
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ class TagReader(
fun readChildTagsByParentTagId(parentTagId: UUID) : List<Tag> {
return tagRepository.findAllChildTagsByParentTagId(parentTagId)
}

fun readByParentTagIdsAndYearAndExperienceCreatedAtDesc(parentTagIds: List<UUID>, year: Int): List<Tag> {
return tagRepository.findByParentTagIdsAndYearAndExperienceCreatedAtDesc(parentTagIds, year)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.bamyanggang.persistence.tag.jpa.entity.TagJpaEntity;
import com.bamyanggang.persistence.tag.jpa.repository.TagJpaRepository;
import com.bamyanggang.persistence.tag.mapper.TagMapper;
import java.time.LocalDateTime;
import java.util.List;
import java.util.UUID;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -69,4 +70,15 @@ public List<Tag> findAllChildTagsByParentTagId(UUID parentTagId) {

return tagJpaEntities.stream().map(tagMapper::toDomainEntity).toList();
}

@Override
public List<Tag> findByParentTagIdsAndYearAndExperienceCreatedAtDesc(List<UUID> parentTagIds, int year) {
LocalDateTime startYear = LocalDateTime.of(year, 1, 1, 0, 0);
LocalDateTime endYear = LocalDateTime.of(year, 12, 31, 23, 59);

List<TagJpaEntity> tagJpaEntities = tagJpaRepository.findByParentTagIdAndYearAndExperienceCreatedAtDesc(
parentTagIds, startYear, endYear);

return tagJpaEntities.stream().map(tagMapper::toDomainEntity).toList();
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
package com.bamyanggang.persistence.tag.jpa.repository;

import com.bamyanggang.persistence.tag.jpa.entity.TagJpaEntity;
import java.time.LocalDateTime;
import java.util.List;
import java.util.UUID;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface TagJpaRepository extends JpaRepository<TagJpaEntity, UUID> {
List<TagJpaEntity> findAllByUserIdAndParentTagIdIsNull(UUID userId);
List<TagJpaEntity> findAllByUserIdAndParentTagId(UUID parentTagId, UUID parentId);
List<TagJpaEntity> findByUserIdAndNameContaining(UUID userId, String name);
List<TagJpaEntity> findAllByParentTagId(UUID parentTagId);

@Query("""
select t from TagJpaEntity t, ExperienceJpaEntity e
where e.parentTagId in :parentTagIds
and e.startedAt between :startYear and :endYear
and e.parentTagId = t.tagId
order by e.createdAt desc
"""
)
List<TagJpaEntity> findByParentTagIdAndYearAndExperienceCreatedAtDesc(@Param("parentTagIds") List<UUID> parentTagIds,
@Param("startYear") LocalDateTime startYear,
@Param("endYear") LocalDateTime endYear);
}
Binary file added Support-Module/Jwt/.jqwik-database
Binary file not shown.
Binary file added Support-Module/cache/.jqwik-database
Binary file not shown.
Binary file added Support-Module/lock/.jqwik-database
Binary file not shown.
Loading