Skip to content

Commit

Permalink
Merge pull request #25 from curator-OEUVRE/dev
Browse files Browse the repository at this point in the history
fix : smallImageUrl 추가 및 해시태그 오류 수정
  • Loading branch information
kim-wonjin authored Sep 23, 2023
2 parents d1587e6 + af12bb8 commit bb19c3f
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
implementation group: 'org.javassist', name: 'javassist', version: '3.15.0-GA'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'io.jsonwebtoken:jjwt:0.9.1'
implementation group: 'com.google.firebase', name: 'firebase-admin', version: '9.0.0'
implementation 'io.github.jav:expo-server-sdk:1.1.0'
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/curator/oeuvre/domain/Picture.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public class Picture extends AbstractTimestamp {
@Column(nullable = false)
private String imageUrl;

@Column(nullable = true)
private String smallImageUrl;

@Column(nullable = false)
private Integer queue;

Expand Down Expand Up @@ -61,6 +64,7 @@ public Picture (
Long no,
Floor floor,
String imageUrl,
String smallImageUrl,
Integer queue,
String title,
String manufactureYear,
Expand All @@ -74,6 +78,7 @@ public Picture (
this.no = no;
this.floor = floor;
this.imageUrl = imageUrl;
this.smallImageUrl = smallImageUrl;
this.queue = queue;
this.title = title;
this.manufactureYear = manufactureYear;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public class PatchFloorPictureDto {
@NotNull(message = "이미지 url을 입력해주세요")
private String imageUrl;

@ApiModelProperty(notes = "작은 이미지 url", example = "small_image_url")
private String smallImageUrl;

@ApiModelProperty(notes = "작품 제목", example = "노을")
@Length(max = 20)
private String title;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public class PostFloorPictureDto {
@NotNull(message = "이미지 url을 입력해주세요")
private String imageUrl;

@ApiModelProperty(notes = "작은 이미지 url", example = "small_image_url")
private String smallImageUrl;

@ApiModelProperty(notes = "작품 제목", example = "노을")
@Length(max = 20)
private String title;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public class GetFloorSearchResponseDto {
@ApiModelProperty(notes = "썸네일 사진 url", example = "image_url")
private final String thumbnailUrl;

@ApiModelProperty(notes = "작은 썸네일 사진 url", example = "image_url")
private final String smallThumbnailUrl;

@ApiModelProperty(notes = "세로 길이", example = "188")
private final Float height;

Expand All @@ -35,13 +38,15 @@ public GetFloorSearchResponseDto(
String floorName,
String exhibitionName,
String thumbnailUrl,
String smallThumbnailUrl,
Float height,
Float width
) {
this.floorNo = floorNo;
this.floorName = floorName;
this.exhibitionName = exhibitionName;
this.thumbnailUrl = thumbnailUrl;
this.smallThumbnailUrl = smallThumbnailUrl;
this.height = height;
this.width = width;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public class GetHomeFloorResponseDto {
@ApiModelProperty(notes = "썸네일 사진 url", example = "image_url")
private final String thumbnailUrl;

@ApiModelProperty(notes = "작은 썸네일 사진 url", example = "small_image_url")
private final String smallThumbnailUrl;

@ApiModelProperty(notes = "세로 길이", example = "188")
private final Float height;

Expand Down Expand Up @@ -67,6 +70,7 @@ public GetHomeFloorResponseDto(
Integer queue,
String exhibitionName,
String thumbnailUrl,
String smallThumbnailUrl,
Float height,
Float width,
Long userNo,
Expand All @@ -84,6 +88,7 @@ public GetHomeFloorResponseDto(
this.queue = queue;
this.exhibitionName = exhibitionName;
this.thumbnailUrl = thumbnailUrl;
this.smallThumbnailUrl = smallThumbnailUrl;
this.height = height;
this.width = width;
this.userNo = userNo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public class GetHashtagPictureDto {
@ApiModelProperty(notes = "이미지 url", example = "image_url")
private final String imageUrl;

@ApiModelProperty(notes = "작은 이미지 url", example = "image_url")
private final String smallImageUrl;

@ApiModelProperty(notes = "작품 제목", example = "노을")
private final String title;

Expand Down Expand Up @@ -63,6 +66,7 @@ public class GetHashtagPictureDto {
public GetHashtagPictureDto (
Long pictureNo,
String imageUrl,
String smallImageUrl,
String title,
String manufactureYear,
String material,
Expand All @@ -80,6 +84,7 @@ public GetHashtagPictureDto (
) {
this.pictureNo = pictureNo;
this.imageUrl = imageUrl;
this.smallImageUrl = smallImageUrl;
this.title = title;
this.manufactureYear = manufactureYear;
this.material = material;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public class GetPictureResponseDto {
@ApiModelProperty(notes = "이미지 url", example = "image_url")
private final String imageUrl;

@ApiModelProperty(notes = "작은 이미지 url", example = "small_image_url")
private final String smallImageUrl;

@ApiModelProperty(notes = "작품 제목", example = "노을")
private final String title;

Expand Down Expand Up @@ -82,6 +85,7 @@ public GetPictureResponseDto (
this.userId = picture.getFloor().getUser().getId();
this.floorNo = picture.getFloor().getNo();
this.imageUrl = picture.getImageUrl();
this.smallImageUrl = picture.getSmallImageUrl();
this.title = picture.getTitle();
this.manufactureYear = picture.getManufactureYear();
this.material = picture.getMaterial();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public class GetMyCollectionResponseDto {
@ApiModelProperty(notes = "이미지 url", example = "image_url")
private final String imageUrl;

@ApiModelProperty(notes = "작은 이미지 url", example = "image_url")
private final String smallImageUrl;

@ApiModelProperty(notes = "세로 길이", example = "188")
private final Float height;

Expand All @@ -29,6 +32,7 @@ public class GetMyCollectionResponseDto {
public GetMyCollectionResponseDto (Picture picture) {
this.pictureNo = picture.getNo();
this.imageUrl = picture.getImageUrl();
this.smallImageUrl = picture.getSmallImageUrl();
this.height = picture.getHeight();
this.width = picture.getWidth();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public class GetUserFloorThumbnailDto {
@ApiModelProperty(notes = "이미지 url", example = "image_url")
private final String imageUrl;

@ApiModelProperty(notes = "작은 이미지 url", example = "image_url")
private final String smallImageUrl;

@ApiModelProperty(notes = "세로 길이", example = "188")
private final Float height;

Expand All @@ -22,6 +25,7 @@ public class GetUserFloorThumbnailDto {

public GetUserFloorThumbnailDto (Picture picture) {
this.imageUrl = picture.getImageUrl();
this.smallImageUrl = picture.getSmallImageUrl();
this.height = picture.getHeight();
this.width = picture.getWidth();
}
Expand Down
13 changes: 10 additions & 3 deletions src/main/java/com/curator/oeuvre/repository/FloorRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public interface FloorRepository extends JpaRepository <Floor, Long> {
@Query(value = "(SELECT distinct floor.no as floorNo, floor.name as floorName, floor.description as floorDescription, floor.queue, user.exhibition_name as exhibitionName, " +
"ifnull((SELECT picture.image_url FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 and picture.no = floor.thumbnail_no), " +
"(SELECT picture.image_url FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1)) as thumbnailUrl, " +
"(SELECT picture.height FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1) as height, " +
"ifnull((SELECT picture.small_image_url FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 and picture.no = floor.thumbnail_no), " +
"(SELECT picture.small_image_url FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1)) as smallThumbnailUrl, " + "(SELECT picture.height FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1) as height, " +
"(SELECT picture.width FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1) as width, " +
"user.no as userNo, user.id, user.profile_image_url as profileImageUrl, " +
"ifnull(floor_read.is_new, false) as isNew, ifnull(floor_read.is_updated, false) as isUpdated, " +
Expand All @@ -47,7 +48,8 @@ public interface FloorRepository extends JpaRepository <Floor, Long> {
"(SELECT distinct floor.no as floorNo, floor.name as floorName, floor.description as floorDescription, floor.queue, user.exhibition_name as exhibitionName, " +
"ifnull((SELECT picture.image_url FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 and picture.no = floor.thumbnail_no), " +
"(SELECT picture.image_url FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1)) as thumbnailUrl, " +
"(SELECT picture.height FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1) as height, " +
"ifnull((SELECT picture.small_image_url FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 and picture.no = floor.thumbnail_no), " +
"(SELECT picture.small_image_url FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1)) as smallThumbnailUrl, " + "(SELECT picture.height FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1) as height, " +
"(SELECT picture.width FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1) as width, " +
"user.no as userNo, user.id, user.profile_image_url as profileImageUrl, " +
"false as isNew, false as isUpdated, 0 as updateCount, true as isMine, floor.updated_at as updatedAt, floor.created_at as createdAt " +
Expand All @@ -72,7 +74,8 @@ public interface FloorRepository extends JpaRepository <Floor, Long> {
@Query(value = "SELECT distinct floor.no as floorNo, floor.name as floorName, floor.description as floorDescription, floor.queue, user.exhibition_name as exhibitionName, " +
"ifnull((SELECT picture.image_url FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 and picture.no = floor.thumbnail_no), " +
"(SELECT picture.image_url FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1)) as thumbnailUrl, " +
"(SELECT picture.height FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1) as height, " +
"ifnull((SELECT picture.small_image_url FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 and picture.no = floor.thumbnail_no), " +
"(SELECT picture.small_image_url FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1)) as smallThumbnailUrl, " + "(SELECT picture.height FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1) as height, " +
"(SELECT picture.width FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1) as width, " +
"user.no as userNo, user.id, user.profile_image_url as profileImageUrl, " +
"false as isNew, false as isUpdated, 0 as updateCount, false as isMine, floor.updated_at as updatedAt, floor.created_at as createdAt " +
Expand All @@ -96,6 +99,7 @@ interface GetHomeFloor {
Integer getQueue();
String getExhibitionName();
String getThumbnailUrl();
String getSmallThumbnailUrl();
Float getHeight();
Float getWidth();
Long getUserNo();
Expand All @@ -111,6 +115,8 @@ interface GetHomeFloor {
@Query(value = "SELECT floor.no as floorNo, floor.name as floorName, user.exhibition_name as exhibitionName, " +
"ifnull((SELECT picture.image_url FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 and picture.no = floor.thumbnail_no), " +
"(SELECT picture.image_url FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1)) as thumbnailUrl, " +
"ifnull((SELECT picture.small_image_url FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 and picture.no = floor.thumbnail_no), " +
"(SELECT picture.small_image_url FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1)) as smallThumbnailUrl, " +
" (SELECT picture.height FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1) as height, " +
" (SELECT picture.width FROM oeuvre.picture WHERE picture.floor_no = floor.no and picture.status = 1 ORDER BY picture.queue LIMIT 1) as width " +
"FROM oeuvre.floor LEFT JOIN oeuvre.user on floor.user_no = user.no " +
Expand All @@ -126,6 +132,7 @@ interface SearchFloor{
String getFloorName();
String getExhibitionName();
String getThumbnailUrl();
String getSmallThumbnailUrl();
Float getHeight();
Float getWidth();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public interface PictureHashtagRepository extends JpaRepository <PictureHashtag,

void deleteByNo(Long pictureHashtagNo);

@Query(value = "SELECT count(l.no) as count, p.no as pictureNo, p.image_url as imageUrl, p.title, p.manufacture_year as manufactureYear, p.material, p.scale, p.description, " +
@Query(value = "SELECT count(l.no) as count, p.no as pictureNo, p.image_url as imageUrl, p.small_image_url as smallImageUrl, p.title, p.manufacture_year as manufactureYear, p.material, p.scale, p.description, " +
" p.height, p.width, p.floor_no as floorNo, u.no as userNo, u.id as userId, u.profile_image_url as profileImageUrl " +
"FROM oeuvre.picture_hashtag ph LEFT JOIN oeuvre.picture p on ph.picture_no = p.no " +
" LEFT JOIN oeuvre.likes l on p.no = l.picture_no " +
Expand All @@ -32,6 +32,7 @@ public interface PictureHashtagRepository extends JpaRepository <PictureHashtag,
interface GetPopularPicture {
Long getPictureNo();
String getImageUrl();
String getSmallImageUrl();
String getTitle();
String getManufactureYear();
String getMaterial();
Expand All @@ -45,7 +46,7 @@ interface GetPopularPicture {
String getProfileImageUrl();
}

@Query(value = "SELECT distinct p.no as pictureNo, p.image_url as imageUrl, p.title, p.manufacture_year as manufactureYear, p.material, p.scale, p.description, p.height, p.width, " +
@Query(value = "SELECT distinct p.no as pictureNo, p.image_url as imageUrl, p.small_image_url as smallImageUrl, p.title, p.manufacture_year as manufactureYear, p.material, p.scale, p.description, p.height, p.width, " +
" p.floor_no as floorNo, user.no as userNo, user.id as userId, user.profile_image_url as profileImageUrl, " +
" (SELECT count(likes.no) FROM oeuvre.picture LEFT JOIN oeuvre.likes ON likes.picture_no = p.no and likes.status = 1 WHERE picture.status = 1) as count " +
"FROM oeuvre.picture p " +
Expand All @@ -55,7 +56,7 @@ interface GetPopularPicture {
"WHERE ph.hashtag_no = :hashtagNo and floor.status = 1 and floor.is_public = true and " +
" p.status = 1 and ph.status = 1 and user.status = 1 and " +
" user.no not in (SELECT blocked_user_no FROM oeuvre.block WHERE block_user_no = :userNo) " +
"ORDER BY count desc, p.created_at desc ",
"ORDER BY count desc, ph.created_at desc ",
countQuery = "SELECT count(*) FROM (SELECT distinct p.no as pictureNo, p.image_url as imageUrl, p.height, p.width, " +
" user.no as userNo, user.id, user.profile_image_url as profileImageUrl, " +
" (SELECT count(likes.no) FROM oeuvre.picture LEFT JOIN oeuvre.likes ON likes.picture_no = p.no and likes.status = 1 WHERE picture.status = 1) as count " +
Expand All @@ -69,7 +70,7 @@ interface GetPopularPicture {
"ORDER BY count desc, p.created_at desc) as c", nativeQuery = true)
Page<GetHashtagPicture> findAllByHashtagNoSortByPopular(@Param("hashtagNo") Long hashtagNo, @Param("userNo") Long userNo, Pageable pageable);

@Query(value = "SELECT distinct p.no as pictureNo, p.image_url as imageUrl, p.title, p.manufacture_year as manufactureYear, p.material, p.scale, p.description, p.height, p.width, " +
@Query(value = "SELECT distinct p.no as pictureNo, p.image_url as imageUrl, p.small_image_url as smallImageUrl, p.title, p.manufacture_year as manufactureYear, p.material, p.scale, p.description, p.height, p.width, " +
" p.floor_no as floorNo ,user.no as userNo, user.id as userId, user.profile_image_url as profileImageUrl " +
"FROM oeuvre.picture p " +
" LEFT JOIN oeuvre.picture_hashtag ph ON p.no = ph.picture_no " +
Expand All @@ -78,7 +79,7 @@ interface GetPopularPicture {
"WHERE ph.hashtag_no = :hashtagNo and floor.status = 1 and floor.is_public = true and " +
" p.status = 1 and ph.status = 1 and user.status = 1 and " +
" user.no not in (SELECT blocked_user_no FROM oeuvre.block WHERE block_user_no = :userNo) " +
"ORDER BY p.created_at desc",
"ORDER BY ph.created_at desc",
countQuery = "SELECT count(*) FROM (SELECT distinct p.no FROM oeuvre.picture p " +
" LEFT JOIN oeuvre.picture_hashtag ph ON p.no = ph.picture_no " +
" LEFT JOIN oeuvre.floor ON p.floor_no = floor.no " +
Expand All @@ -91,6 +92,7 @@ interface GetPopularPicture {
interface GetHashtagPicture {
Long getPictureNo();
String getImageUrl();
String getSmallImageUrl();
String getTitle();
String getManufactureYear();
String getMaterial();
Expand Down
Loading

0 comments on commit bb19c3f

Please sign in to comment.