Skip to content

Commit

Permalink
Merge pull request #98 from YAPP-Github/develop
Browse files Browse the repository at this point in the history
메인 브랜치에 개발용 브랜치 반영
  • Loading branch information
akalswl14 authored Feb 16, 2023
2 parents 32d9509 + c14c32f commit 2107197
Show file tree
Hide file tree
Showing 34 changed files with 341 additions and 371 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import lombok.RequiredArgsConstructor;
import org.apache.http.HttpEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand All @@ -47,7 +46,7 @@ public class ArtworkController {

private final ArtworkService artworkService;

@Operation(summary = "전시 작품 추가", description = "작품(이미지)를 전시에 추가")
@Operation(summary = "전시 작품 등록", description = "작품(이미지)를 전시에 추가(등록)")
@ApiResponses(value = {
@ApiResponse(
responseCode = "201",
Expand Down Expand Up @@ -125,8 +124,8 @@ public ResponseEntity<Page<ArtworkThumbnailDto>> getArtworkPageFromPost(
@RequestParam(name = "direction", required = false, defaultValue = "DESC") Direction direction) {

Long userId = getUserId(authentication);
return ResponseEntity.ok().body(artworkService.getArtworkAsPage(exhibitId, userId,
PageRequest.of(page, size, direction, "createdAt")));
return ResponseEntity.ok()
.body(artworkService.getArtworkAsPage(exhibitId, userId, page, size, direction));
}

@Operation(summary = "작품 상세 정보 조회", description = "작품 상세 페이지의 작품 상세 정보 조회")
Expand Down Expand Up @@ -269,7 +268,8 @@ public ResponseEntity<? extends HttpEntity> deleteArtwork(
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class))),
})
@PostMapping("batch/{id}")
public ResponseEntity<CreateArtworkBatchResponseDto> createArtwork(Authentication authentication,
public ResponseEntity<CreateArtworkBatchResponseDto> createArtworkBatch(
Authentication authentication,
@Parameter(name = "id", description = "전시 ID", in = ParameterIn.PATH) @Valid @PathVariable("id") Long exhibitId,
@RequestBody @Valid CreateArtworkBatchRequestDto createArtworkBatchRequestDtoRequestDto) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,16 @@ public void addArtwork(Artwork artwork) {
artwork.display(this);
}

public static Exhibit create(String name, LocalDate postDate, Category category, User user) {
ExhibitContents contents = new ExhibitContents(name, null, null, postDate);
public static Exhibit create(String name, LocalDate postDate, Category category, User user,
String attachedLink) {
ExhibitContents contents = new ExhibitContents(name, null, attachedLink, postDate);
Publication publication = new Publication();
return new Exhibit(user, category, contents, publication);
}

public void update(String name, LocalDate postDate, Category category) {
public void update(String name, LocalDate postDate, String attachedLink, Category category) {
this.contents = new ExhibitContents(name, contents().getReview(),
contents().getAttachedLink(), postDate);
attachedLink, postDate);
categorize(category);
}

Expand Down

This file was deleted.

This file was deleted.

19 changes: 12 additions & 7 deletions src/main/java/com/yapp/artie/domain/archive/domain/tag/Tag.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.yapp.artie.domain.archive.domain.tag;

import com.yapp.artie.domain.archive.domain.artwork.Artwork;
import com.yapp.artie.domain.user.domain.User;
import com.yapp.artie.global.common.BaseEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
Expand All @@ -17,7 +17,7 @@
@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Tag extends BaseEntity {
public class Tag {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand All @@ -27,15 +27,20 @@ public class Tag extends BaseEntity {
@JoinColumn(name = "user_id", nullable = false)
private User user;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "image_id", nullable = false)
private Artwork artwork;

@Column(nullable = false, name = "seq")
private int sequence;

@Column(nullable = false)
private String name;

public Tag(User user, String name) {
public Tag(User user, Artwork artwork, int sequence, String name) {
this.user = user;
this.artwork = artwork;
this.sequence = sequence;
this.name = name;
}

public static Tag create(User user, String name) {
return new Tag(user, name);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.yapp.artie.domain.archive.dto.artwork;

import com.yapp.artie.domain.archive.dto.tag.TagDto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -35,11 +34,11 @@ public class ArtworkInfoDto {
@Valid
@NonNull
@Schema(description = "감정 태그 목록", required = true)
private List<TagDto> tags;
private List<String> tags;

@Builder
public ArtworkInfoDto(@NonNull Long id, @NonNull String imageURL, String name,
String artist, List<TagDto> tags) {
String artist, List<String> tags) {
this.id = id;
this.imageURL = imageURL;
this.name = name == null ? "작품명 미입력" : name;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.yapp.artie.domain.archive.dto.artwork;

import com.yapp.artie.domain.archive.dto.tag.CreateArtworkTagDto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.ArrayList;
import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;

@Getter
@Schema(description = "전시 작품 생성 Request")
Expand All @@ -35,10 +35,15 @@ public class CreateArtworkRequestDto {

@Valid
@Schema(description = "작품 할당 태그")
private List<CreateArtworkTagDto> tags = new ArrayList<>();
private List<@NotBlank String> tags;

public CreateArtworkRequestDto(Long postId, String imageUri) {
@Builder
public CreateArtworkRequestDto(@NonNull Long postId, @NonNull String imageUri, String artist,
String name, List<String> tags) {
this.postId = postId;
this.imageUri = imageUri;
this.artist = artist;
this.name = name;
this.tags = tags;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.yapp.artie.domain.archive.dto.artwork;

import com.yapp.artie.domain.archive.dto.tag.CreateArtworkTagDto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
Expand All @@ -22,10 +22,10 @@ public class UpdateArtworkRequestDto {

@Valid
@Schema(description = "작품 할당 태그")
private List<CreateArtworkTagDto> tags;
private List<@NotBlank String> tags;

@Builder
public UpdateArtworkRequestDto(String artist, String name, List<CreateArtworkTagDto> tags) {
public UpdateArtworkRequestDto(String artist, String name, List<String> tags) {
this.artist = artist;
this.name = name;
this.tags = tags;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ public class CreateExhibitRequestDto {
@Schema(description = "관람 날짜")
private LocalDate postDate;

public CreateExhibitRequestDto(String name, Long categoryId, LocalDate postDate) {
@Schema(description = "전시 링크", nullable = true)
private String attachedLink;

public CreateExhibitRequestDto(String name, Long categoryId, LocalDate postDate,
String attachedLink) {
this.name = name;
this.categoryId = categoryId;
this.postDate = postDate;
this.attachedLink = attachedLink;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,20 @@ public class PostDetailInfo {
@Schema(description = "대표 이미지")
private String mainImage;

@Schema(description = "전시 링크")
private String attachedLink;

@Builder
public PostDetailInfo(@NonNull Long id, @NonNull String name, @NonNull LocalDate postDate,
boolean isPublished, @NonNull Long categoryId, @NonNull String categoryName,
String mainImage) {
String mainImage, String attachedLink) {
this.id = id;
this.name = name;
this.postDate = postDate;
this.isPublished = isPublished;
this.categoryId = categoryId;
this.categoryName = categoryName;
this.mainImage = mainImage;
this.attachedLink = attachedLink;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public class PostInfoDto {
@Schema(description = "관람 날짜")
private final LocalDate postDate;

@Schema(description = "전시 링크")
private final String attachedLink;

@Schema(description = "임시 저장 여부")
private final boolean isPublished;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@ public class UpdateExhibitRequestDto {
@Schema(description = "수정할 날짜")
private LocalDate postDate;

@Schema(description = "변경할 카테고리 ID")
@Schema(description = "수정할 카테고리 ID")
private Long categoryId;

public UpdateExhibitRequestDto(String name, LocalDate postDate, Long categoryId) {
@Schema(description = "수정할 전시 링크")
private String attachedLink;

public UpdateExhibitRequestDto(String name, LocalDate postDate, Long categoryId,
String attachedLink) {
this.name = name;
this.postDate = postDate;
this.categoryId = categoryId;
this.attachedLink = attachedLink;
}
}

This file was deleted.

This file was deleted.

20 changes: 0 additions & 20 deletions src/main/java/com/yapp/artie/domain/archive/dto/tag/TagDto.java

This file was deleted.

This file was deleted.

Loading

0 comments on commit 2107197

Please sign in to comment.