-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [fix #142] 앨범 내 사진 조회 최신순으로 정렬 (#143) * [fix #140] 앨범 공유 수락 API 로직 수정 (#144) * [feat #128] 포토부스 관련 API 구현 (#146) * [feat #128] 포토부스 관련 API 구현 * [fix #128] Photo 공유 수락 API 로직 수정 * [chore #128] swagger 업데이트 * [chore #128] 공백 제거 * [fix #147] 포포리즘 공유 API 수정 (#148) * [feat #128] 포토부스 관련 API 구현 * [fix #128] Photo 공유 수락 API 로직 수정 * [chore #128] swagger 업데이트 * [chore #128] 공백 제거 * [fix #147] 포포리즘 공유 API 수정 * [chore #147] swagger 수정 * [hotfix #149] 포포리즘 공유 API request body 수정 (#150) * [hotfix #149] 포포리즘 공유 request body 수정 * [chore #149] 사용하지 않는 import 제거 * [setting #149] banner 추가 * [chore #149] CI 스크립트 수정 * [chore #149] CI prod 스크립트 수정 * [chore #149] cd 스크립트 수정 * [fix #151] 배포 전 버그 수정 (access token 만료 시간 변경, 포포리즘 공유 API 수정) (#152) * [fix #151] Access Token 만료시간 변경 * [fix #151] 사진 upload url 변경 * [fix #151] 포포리즘 공유시에 이미지 저장 url 변경 (#153) * [fix #151] Access Token 만료시간 변경 * [fix #151] 사진 upload url 변경 * [hotfix #151] 포포리즘 저장 url 변경 * [refactor #156] slack 회원가입시에 알람 추가 (#157) * [refactor #156] slack 회원가입시에 알람 추가 * [fix #156] IOException 처리 * [fix #158] slack 메세지 알림 수정 (#159) * [fix #158] 어노테이션 변경 (#160) * [fix #158] slack 메세지 알림 수정 * [fix #158] annotation 변경 * [test #163] add domain test code (#167) * [feat #169] 토큰 재발급, 회원 탈퇴 API V2 구현 (#170) * [feat #169] 토큰 재발급, 회원 탈퇴 API V2 구현 * [feat #169] 애플리케이션 실행 스크립트 추가 * [refactor #165] slack 알림 기능 고도화 (#171) * [fix #174] slack activeProfile 분기처리 로직 추가 (#175) * [FEAT] 광고 목록 조회 API 구현 (#179) * [feat #178] 광고 테이블 설계 * [feat #178] 광고 목록 조회 API 구현 --------- Co-authored-by: Yunseo Kang <[email protected]>
- Loading branch information
Showing
9 changed files
with
222 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/main/java/com/pophory/pophoryserver/domain/advertisement/Advertisement.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.pophory.pophoryserver.domain.advertisement; | ||
|
||
|
||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Getter | ||
public class Advertisement { | ||
|
||
@Id @GeneratedValue(strategy = GenerationType.AUTO) | ||
private Integer id; | ||
|
||
private String adId; | ||
|
||
@Column(name = "ios_version") | ||
|
||
private String iOSVersion; | ||
|
||
@Column(name = "android_version") | ||
private String androidVersion; | ||
|
||
private String adName; | ||
|
||
@Builder | ||
public Advertisement(String adId, String iOSVersion, String androidVersion, String adName) { | ||
this.adId = adId; | ||
this.iOSVersion = iOSVersion; | ||
this.androidVersion = androidVersion; | ||
this.adName = adName; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/com/pophory/pophoryserver/domain/advertisement/AdvertisementJpaRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.pophory.pophoryserver.domain.advertisement; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface AdvertisementJpaRepository extends JpaRepository<Advertisement,Integer> { | ||
} |
37 changes: 37 additions & 0 deletions
37
...ain/java/com/pophory/pophoryserver/domain/advertisement/AdvertisementQueryRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.pophory.pophoryserver.domain.advertisement; | ||
|
||
|
||
import com.pophory.pophoryserver.domain.advertisement.dto.response.AdvertisementResponse; | ||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import static com.pophory.pophoryserver.domain.advertisement.QAdvertisement.advertisement; | ||
|
||
@Repository | ||
@RequiredArgsConstructor | ||
public class AdvertisementQueryRepository { | ||
|
||
private static final String ANDRIOD_OS = "android"; | ||
private static final String IOS_OS = "ios"; | ||
|
||
private final JPAQueryFactory queryFactory; | ||
|
||
public List<Advertisement> findAllByOSAndVersion(String os, String version) { | ||
switch (os) { | ||
case ANDRIOD_OS: | ||
return queryFactory.selectFrom(advertisement) | ||
.where(advertisement.androidVersion.eq(version)) | ||
.fetch(); | ||
case IOS_OS: | ||
return queryFactory.selectFrom(advertisement) | ||
.where(advertisement.iOSVersion.eq(version)) | ||
.fetch(); | ||
} | ||
return new ArrayList<>(); | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/pophory/pophoryserver/domain/advertisement/AdvertisementService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.pophory.pophoryserver.domain.advertisement; | ||
|
||
|
||
import com.pophory.pophoryserver.domain.advertisement.dto.response.AdvertisementResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional(readOnly = true) | ||
public class AdvertisementService { | ||
|
||
private final AdvertisementQueryRepository advertisementQueryRepository; | ||
|
||
public List<AdvertisementResponse> getAdvertisements(String os, String version) { | ||
List<Advertisement> advertisements = advertisementQueryRepository.findAllByOSAndVersion(os, version); | ||
return advertisements.stream() | ||
.map(AdvertisementResponse::of) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
src/main/java/com/pophory/pophoryserver/domain/advertisement/AdvertisementV2Controller.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.pophory.pophoryserver.domain.advertisement; | ||
|
||
|
||
import com.pophory.pophoryserver.domain.advertisement.dto.response.AdvertisementResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.enums.ParameterIn; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.security.SecurityRequirement; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v2/ad") | ||
@Tag(name = "[Advertisement] 광고 관련 API (V2)") | ||
@SecurityRequirement(name = "Authorization") | ||
public class AdvertisementV2Controller { | ||
|
||
private final AdvertisementService advertisementService; | ||
|
||
@GetMapping | ||
@Operation(summary = "광고 목록 조회 API") | ||
@Parameter(name = "Authorization", description = "Bearer {access_token}", in = ParameterIn.HEADER, required = true, schema = @Schema(type = "string")) | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "광고 목록 조회 성공"), | ||
@ApiResponse(responseCode = "400", description = "앨범 목록 조회 실패", content = @Content), | ||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) | ||
}) | ||
public ResponseEntity<List<AdvertisementResponse>> getAdvertisements(@RequestParam String os, @RequestParam String version) { | ||
return ResponseEntity.ok(advertisementService.getAdvertisements(os, version)); | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
...va/com/pophory/pophoryserver/domain/advertisement/dto/response/AdvertisementResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.pophory.pophoryserver.domain.advertisement.dto.response; | ||
|
||
import com.pophory.pophoryserver.domain.advertisement.Advertisement; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class AdvertisementResponse { | ||
private String adId; | ||
private String adName; | ||
|
||
public static AdvertisementResponse of(Advertisement advertisement) { | ||
return new AdvertisementResponse(advertisement.getAdId(), advertisement.getAdName()); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/test/java/com/pophory/pophoryserver/domain/advertisement/AdvertisementServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.pophory.pophoryserver.domain.advertisement; | ||
|
||
public class AdvertisementServiceTest { | ||
} |
32 changes: 32 additions & 0 deletions
32
src/test/java/com/pophory/pophoryserver/domain/advertisement/AdvertisementTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.pophory.pophoryserver.domain.advertisement; | ||
|
||
|
||
import com.pophory.pophoryserver.config.TestConfig; | ||
import com.pophory.pophoryserver.fixture.advertisement.AdvertisementFixture; | ||
import lombok.RequiredArgsConstructor; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.test.context.ActiveProfiles; | ||
|
||
@ActiveProfiles("test") | ||
@DataJpaTest | ||
@RequiredArgsConstructor | ||
@Import(TestConfig.class) | ||
public class AdvertisementTest { | ||
|
||
@Autowired | ||
private final AdvertisementJpaRepository advertisementJpaRepository; | ||
|
||
@DisplayName("광고 객체가 성공적으로 만들어진다.") | ||
@Test | ||
void test() { | ||
// given | ||
Advertisement advertisement = AdvertisementFixture.createAdvertisementFixture(); | ||
// when | ||
advertisementJpaRepository.save(advertisement); | ||
// then | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/test/java/com/pophory/pophoryserver/fixture/advertisement/AdvertisementFixture.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.pophory.pophoryserver.fixture.advertisement; | ||
|
||
import com.pophory.pophoryserver.domain.advertisement.Advertisement; | ||
|
||
public class AdvertisementFixture { | ||
|
||
private static final String AD_NAME = "adName"; | ||
private static final String AD_ID = "adId"; | ||
private static final String ANDROID_VERSION = "1.0.1"; | ||
private static final String IOS_VERSION = "1.0.2"; | ||
|
||
public static Advertisement createAdvertisementFixture() { | ||
return Advertisement.builder() | ||
.adName(AD_NAME) | ||
.adId(AD_ID) | ||
.androidVersion(ANDROID_VERSION) | ||
.iOSVersion(IOS_VERSION) | ||
.build(); | ||
} | ||
} |